[DB-SIG] Python/PostgreSQL API performance comparison

Federico Di Gregorio fog at initd.org
Mon Jun 2 18:42:42 EDT 2003


Il sab, 2003-05-24 alle 21:55, Chris Cogdon ha scritto:
> Hey folks! This post is more a 'for your edification' than a call for 
> comments, but comments are welcome :)
> 
> I'm in the process of rewriting all the database glue logic for my 
> rather heavily used[1]  website. In the process I discovered that the 
> new code runs significantly slower than the old, and that worries me 
> since the website IS rather heavily used, and I was hoping to move to 
> dynamic generation for a lot of the pages. I believe a good deal of the 
> slowdown was my overuse of 'elegant but slow' coding, and I intend to 
> remedy that. But, I also decided how much was due to the change from 
> the old 'pg' API to the dbapi-2.0 compliant PgSQL.
> 
> I wrote a little program that sends through a couple of complex queries 
> to the DB and retrieves the values using a variety of API's:
> 
> - D'Arcy's 'pg' module
> - D'Arcy's dbapi-2.0-compliant 'pgdb' module
> - PgSQL
> - PgSQL with DECLARE cursor's off
> - PoPy
> 
> In all cases, I ran the query three times as a 'warm up', then another 
> 10 and timed that using os.times() The results are as follows:
> 
> method [ user time, system time, child user time, child system time, 
> real time ]
> pg [ 0.110, 0.010, 0.000, 0.000, 29.050 ]
> pgdb [ 4.490, 0.010, 0.000, 0.000, 33.230 ]
> PgSQL [ 3.640, 0.000, 0.000, 0.000, 40.930 ]
> PgSQL (nocursor) [ 3.630, 0.010, 0.000, 0.000, 32.280 ]
> PoPy [ 0.130, 0.010, 0.000, 0.000, 29.030 ]

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

-- 
Federico Di Gregorio
Debian GNU/Linux Developer                                fog at debian.org
INIT.D Developer                                           fog at initd.org
  Debian. The best software from the best people [see above]
                                      -- brought to you by One Line Spam
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Questa parte del messaggio =?ISO-8859-1?Q?=E8?= firmata
Url : http://mail.python.org/pipermail/db-sig/attachments/20030602/08bef1fb/attachment.bin


More information about the DB-SIG mailing list