[PyGreSQL] pygresql connection speeds issue
Christoph Zwerschke
cito at online.de
Sat Apr 21 07:14:11 EDT 2007
Hi Hagop,
> But when I have to carry out a select query,
> it can take up to 6 or 7 seconds, even for queries
> from tables that are no larger than 60 or 70 rows
> and that are indexed.
> ...
> Initially I thought this was because of the overheads
> of the connection, but in this event, inserts should
> also take very long, shouldn't they?
You're right, creating a connection is a certain overhead, but it should
not be THAT much ;-) Something that is also important is to VACUUM your
database tables, but for a table with 60 rows that cannot be the reason
as well (plus PostgreSQL 8.2 has auto vaccuum). So something in your
database setup seems to be foul. Have a look at the database server
logs. What happens if you do the same things with PgAdmin? Does it
happen with both the pg and pgdb adapters?
If you're worried about the connection overhead you can use a connection
pool (e.g. http://www.webwareforpython.org/DBUtils), but this is
certainly not causing the delays you are seeing here.
-- Chris
More information about the PyGreSQL
mailing list