Обсуждение: Force termination of an idle connection

Поиск
Список
Период
Сортировка

Force termination of an idle connection

От
miller_2555
Дата:
Hi -

I have a multi-threaded application that spawns child processes, inserts
information into the database, then disconnects. For whatever reason, some
of the children do not disconnect and the database is left with idle
connections (that eventually max out over time). How can I either force the
child thread to terminate the connection or have the database force a
disconnect after a specified time of inactivity? This is not an embedded C
application, and I believe the `statement_timeout` option only applies to
the database latency for each statement (though please correct me if I am
wrong). Ideally, the solution would be the logical equivalent of either
`terminate after n (milli)seconds of inactivity` or, a less desirable, `keep
this connection open for at most n seconds/minutes.` I'd prefer to avoid
polling the pg_stat_activity table to kill pids

Thanks!
--
View this message in context: http://www.nabble.com/Force-termination-of-an-idle-connection-tp25375135p25375135.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.