Is it possible to configure PostgreSQL to automatically close idle connections? Clients connect to our PostgreSQL 8.3 database but leave the connections opened. Is it possible to configure PostgreSQL to close those connections after a certain amount of inactivity?
Finally, I have a solution.
I'll use the tool PgBouncer with its parameter server_idle_timeout.



Another approach would consist in using some cron-like tool running a query periodically to find idle connections.

Once those idle connections are found, a simple call to pg_terminate_backend will close them.

See an in depth description of this approach in the anwser of the following question: 

How to close idle connections in PostgreSQL automatically?