Re: [PyGreSQL] pg_stat_activity howto

From: raf <raf(at)raf(dot)org>
To: pygresql(at)Vex(dot)Net, pgsql-admin(at)postgresql(dot)org
Subject: Re: [PyGreSQL] pg_stat_activity howto
Date: 2009-11-07 01:04:37
Message-ID: 20091107010437.GB22871@raf.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Christoph Zwerschke wrote:

> raf schrieb:
> >that's a worry :) i have a pygresql-using user application
> >(postgres-8.3.7, python-2.6, pygresql-3.8.1) that is always
> >idle in transaction when it is idle. upon connecting, it
> >calls a few database functions, committing after each one.
> >after that, it's idle in transaction until the next bout of
> >db activity.
> >
> >can anyone explain what i'm doing wrong in the attached example?
>
> One thing is that you should always explicitely close cursors and
> connections when you do not need them any more.

the cursor should close automatically when the python object
is destroyed. and i need the db connection later so closing
that isn't efficient.

> But the real cause of your problem is that Pygres 3.8.1 used to
> implicitely start a connection after every commit(). I have improved
> this already 3 years ago. Please use the current version Pygres 4.0.

ah, so that's the reason. ok, now i have another reason to upgrade.

> -- Christoph

thanks,
raf

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message rahimeh khodadadi 2009-11-09 06:16:40 Re: configuration kerberos in Postgre sql
Previous Message raf 2009-11-07 00:44:13 Re: pg_stat_activity howto