Re: Session Identifiers - Mailing list pgsql-general

From Michael Paquier
Subject Re: Session Identifiers
Date
Msg-id CAB7nPqR-=U=S31DD6Bi51VphsysA1vWZGCSWc3s51bxTg4vWdQ@mail.gmail.com
Whole thread Raw
In response to Re: Session Identifiers  (Stephen Frost <sfrost@snowman.net>)
Responses Re: Session Identifiers  (oleg yusim <olegyusim@gmail.com>)
List pgsql-general
On Tue, Dec 22, 2015 at 1:42 AM, Stephen Frost <sfrost@snowman.net> wrote:
> Oleg,
>
> * oleg yusim (olegyusim@gmail.com) wrote:
>> tcp_keepalives_idle = 900
>> tcp_keepalives_interval=0
>> tcp_keepalives_count=0
>>
>> Doesn't terminate connection to database in 15 minutes of inactivity of
>> psql prompt. So, it looks like that would work only for case if network
>> connection is broken and session left hanging. For psql prompt case looks
>> like pg_terminate_backend() would be the only solution.
>
> Those settings aren't for controlling idle timeout of a connection.
>
> pg_terminate_backend() will work and could be run out of a cronjob.

Or a background worker if you are using PG >= 9.3:
https://github.com/michaelpq/pg_plugins/tree/master/kill_idle
This has the advantage to not have the cronjob error out should the
server be stopped. That's less error handling to take care of at
frontend level.
--
Michael


pgsql-general by date:

Previous
From: Amit Bondwal
Date:
Subject: Re: BDR error while adding 3rd node to cluster
Next
From: Aleksander Łukasz
Date:
Subject: Table with seemingly duplicated primary key values