I can't say wether MySQL is faster for very small queries (like
SELECT'ing one row based on an indexed field).
That's why I was asking you about the language...
I assume you're using a persistent connection.
For simple queries like this, PG 8.x seemed to be a lot faster than PG
7.x. Have you tried 8 ?
I was asking you which language, because for such really small queries
you have to take into account the library overhead. For instance, in PHP a
simple query can be 10 times slower in Postgres than in MySQL and I
believe it is because php's MySQL driver has seen a lot of optimization
whereas the postgres driver has not. Interestingly, the situation is
reversed with Python : its best postgres driver (psycopg 2) is a lot
faster than the MySQL adapter, and faster than both php adapters (a lot
The same query can get (this is from the back of my head):
PHP+Postgres 3-5 ms
PHP+MySQL 0.5 ms
Python+Postgres 0.15 ms
And yes, I had queries executing in 150 microseconds or so, this includes
time to convert the results to native python objects ! This was on a loop
of 10000 times the same query. But psycopg2 is fast. The overhead for
parsing a simple query and fetching just a row is really small.
This is on my Centrino 1.6G laptop.
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings