有人测评说Postgresql 8.1 比 MySQL5要快
引用:
RE: The best open source database? arguably?
By unoengborg on 2005-11-07 23:34:09 UTC in reply to "The best open source databa..."
I did a small comparison of Postgresql 8.1 vs MySQL 5.
I created a table:
CREATE TABLE filedata (
path character varying(1024) NOT NULL,
md5 character varying(80) NOT NULL,
size integer
);
On Postgresql I also added a primary key constraint. MySQL didn't allow me to do that, as it told me that the key was too big:
ALTER TABLE ONLY filedata
ADD CONSTRAINT filedata_pkey PRIMARY KEY (path);
I Entered 586137 records, then I performed the following query:
select b.path,b.size, a.md5 from
(select md5, count(path)
from filedata
group by md5
having count(path)>1) a, filedata b
where a.md5=b.md5 order by a.md5,size;
Postgresql returnd with an answer in about 20 minutes. MySQL is still running, and have been running for over six hours by now. Running two queries simultaneously on Postgresql didn't change the response time significantly.
I used an old IBM Thinkpad 600 laptop, with a 500MHz Pentium III for Postgresql. For MySQL I used a 1 GHz Pentium IV and 1 GB RAM. Both machines had the same services and programs running, apart from the difference in the choise of database.
Both databases used one disk for all their needs i.e. no separate disk for logging, the disk also contained the OS. No special configuration was made to either of them. The OS used was Fedora Core 4.
This really doesn't look too god for MySQL. I'm sure that there is some way to tune MySQL for better performance, but most will compare them on how they perform out of the box.
For one thing you could replace the default InnoDB tables of MySQL with the old engine used in older versions of MySQL, but that would also mean saying good bye to many features that most people take for granted in a RDBMS.
On the positive side, the count(*) function seam to be much faster in MySQL. Counting all the tuples in the table returned allmost instantly in MySQL while Postgresql needed about 2 seconds.