Re: Looking for tips

From: PFC <lists(at)boutiquenumerique(dot)com>
To: "Oliver Crosby" <ryusei(at)gmail(dot)com>, "Richard Huxton" <dev(at)archonet(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Looking for tips
Date: 2005-07-19 19:14:04
Message-ID: op.st6c1qolth1vuj@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


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
faster).

The same query can get (this is from the back of my head):

PHP+Postgres 3-5 ms
Python+MySQL 1ms
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.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2005-07-19 19:16:31 Re: Looking for tips
Previous Message Steinar H. Gunderson 2005-07-19 19:12:03 Re: Looking for tips