Re: removing idle connections

From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: Josh Close <narshe(at)gmail(dot)com>
Subject: Re: removing idle connections
Date: 2004-10-19 19:27:57
Message-ID: 41756ABD.8080903@bigfoot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Josh Close wrote:
> Is there a way to remove idle connections? My postgres server is
> getting serveral hundred idle connections. It's due to a postgres .NET
> provider not closing the connections properly. I don't want to kill
> them all, or restart postgres everytime the connections go crazy.

I do not think is problem of not close the connections.
I bet the driver is acting like this:

On connection:
. Connect
. start transaction

On Commit:
. commit transaction
. start transaction

On Abort:
. abort transaction
. start transaction

On statemet:
. execute statement

As you can see you are always inside a transaction, idle I mean.
BTW this is the behaviour of python driver PgDB ( I suggest to
use psycopg instead ) and before the 8.0 series the JDBC driver
did the same. The way to solve it is, delay the begin till the first
statement:

On connection:
. Connect

On Commit:
. commit transaction

On Abort:
. abort transaction

On statemet:
. If is the first statement after a connection or a commit or
an abort execute the: start transaction
. execute statement

For rpm mantainer: why do not include the psycopg instead of the actual
python driver ?

Regards
Gaetano Mendola

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marc G. Fournier 2004-10-19 19:39:54 Re: download postgreql problem
Previous Message Jonathan Villa 2004-10-19 19:27:17 Segmentation Fault using PHP code