pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PFC <lists@boutiquenumerique.com>
To: Oliver Crosby <ryusei@gmail.com>
To: Richard Huxton <dev@archonet.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Looking for tips
Date: Tue, 19 Jul 2005 21:14:04 +0200
Message-ID: <op.st6c1qolth1vuj@localhost> (raw)
In-Reply-To: <1efd553a05071911413e50ea90@mail.gmail.com>
References: <1efd553a05071910427b290203@mail.gmail.com>
	<42DD420C.2010306@archonet.com>
	<1efd553a05071911413e50ea90@mail.gmail.com>


	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.



view thread (28+ messages)  latest in thread

Message-ID: <op.st6c1qolth1vuj@localhost>
Permalink:  ../op.st6c1qolth1vuj@localhost/
Also on:    postgresql.org/message-id/op.st6c1qolth1vuj@localhost

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: lists@boutiquenumerique.com, ryusei@gmail.com, dev@archonet.com
  Subject: Re: Looking for tips
  In-Reply-To: <op.st6c1qolth1vuj@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox