Force termination of an idle connection - Mailing list pgsql-general

From miller_2555
Subject Force termination of an idle connection
Date
Msg-id 25375135.post@talk.nabble.com
Whole thread Raw
List pgsql-general
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.


pgsql-general by date:

Previous
From: Chris
Date:
Subject: Re: pg_dump exists without any message when running from windows task scheduler
Next
From: "Peter Headland"
Date:
Subject: COPY command character set