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