[DB-SIG] Python/PostgreSQL API performance comparison

Chris Cogdon chris at cogdon.org
Mon Jun 2 12:43:12 EDT 2003


On Monday, Jun 2, 2003, at 10:42 US/Pacific, Federico Di Gregorio wrote:

> would you add psycopg to the tests, please. just eager to know how well
> it does.

Ah, thanks for reminding me about your module :) Here's the results:

pg [ 0.180, 0.010, 0.000, 0.000, 29.610 ]
pgdb [ 4.570, 0.000, 0.000, 0.000, 33.520 ]
PgSQL [ 4.480, 0.010, 0.000, 0.000, 42.450 ]
PgSQL (nocursor) [ 4.480, 0.010, 0.000, 0.000, 33.530 ]
PgSQL (nocursor,list) [ 3.620, 0.020, 0.000, 0.000, 32.570 ]
PoPy [ 0.200, 0.010, 0.000, 0.000, 29.280 ]
psycopg [ 0.300, 0.010, 0.000, 0.000, 29.330 ]

Vigilant readers will note that the figures are a little larger than 
those I posted last time. A fair bit of data has been added to the 
database since. Yes, having a 'consistent framework' would be nice, 
but... I never said these were 'laboratory quality' values :)

So... psycopg performs pretty well... but... I'm sure you could squeeze 
that 0.1 out, couldn't you? :) Reading up on the docs for psycopg, it 
appears it's designed to perform well under heavy-load applications 
with multiple, persistant connections to the database. I might see if I 
can design a test to shake out that particular metric, since that's 
very important for my application.

I've also noticed that some database connectors do not handle 8-byte 
integer values properly. For example, a select sum(file_size) would 
return 2^31-1 rather than the correct, larger value (as a python 
bigint). Yes, I have the source, and could probably fix it myself, but 
it's an interesting metric nevertheless. The results are:

pg/pgdb: Fails on my linux box, but works on a netbsd box. Needs 
investigation.
PgSQL: Works
PoPy: Fails
psycopg: Works

-- 
    ("`-/")_.-'"``-._        Chris Cogdon <chris at cogdon.org>
     . . `; -._    )-;-,_`)
    (v_,)'  _  )`-.\  ``-'
   _.- _..-_/ / ((.'
((,.-'   ((,/   fL




More information about the DB-SIG mailing list