Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Clearing out old idle connections


  • From: "Ivan Zolotukhin" <ivan(dot)zolotukhin(at)gmail(dot)com>
  • To: "Gavin Hamill" <gdh(at)laterooms(dot)com>
  • Cc: pgsql-general(at)postgresql(dot)org
  • Subject: Re: Clearing out old idle connections
  • Date: Wed, 24 May 2006 15:13:50 +0400
  • Message-id: <751e56400605240413o462e6d56na820f4746e5b6dda(at)mail(dot)gmail(dot)com>

Hello,

We have pg 8.1.3 and for whatever reason (network blips, poor pooling on
behalf of the client, etc.) we sometimes see a large number (dozens) of
old connections in the idle state which never get reused.

It seems that I have more or less the same problem. Sometimes I see in
`ps aux` lots of idle connections from web application. They disappear
in several minutes but I do not know what the reason of it and how
they disappear. I have statement_timeout by it obviously is not
related with these clients since they are idle.

Is there a function in postgres similar to MySQL's 'wait_timeout' which
automatically closes any connections which have been idle for N seconds?
Is this functionality possible to to script/cron by examining the pg
catalogs and finding a 'last used' timestamp?

It is possible to find out time of backend start and it's state
through pg_stat_activity view. But I'd prefer not to kill -QUIT these
connections if there's something special for this situation built in
PostgreSQL.

Regards,
Ivan Zolotukhin



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group