Re: Auto close idle connections for specific user (not by pg_cancel command)

From: Thomas Poty <thomas(dot)poty(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: emilu(at)encs(dot)concordia(dot)ca, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Auto close idle connections for specific user (not by pg_cancel command)
Date: 2019-02-05 18:23:52
Message-ID: CAN_ctnjHXafXYXB-on+hMLdoD=B=YsXYYwW60yU0JALtESc1LQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Or you could use
Parameter idle_in_transaction_session_timeout

https://www.cybertec-postgresql.com/en/idle_in_transaction_session_timeout-terminating-idle-transactions-in-postgresql/

And use alter role in database set idle_in_transaction_session_timeout to...

https://www.postgresql.org/docs/10/sql-alterrole.html

Regards

Le mar. 5 févr. 2019 à 18:59, Thomas Poty <thomas(dot)poty(at)gmail(dot)com> a écrit :

> Hi,
> Maybe pgterminator could help you
> https://github.com/trustly/pgterminator
> Regards
> Thomas
>
> Le mar. 5 févr. 2019 à 18:52, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> a
> écrit :
>
>> Hi
>>
>>
>> út 5. 2. 2019 v 18:47 odesílatel Emi <emilu(at)encs(dot)concordia(dot)ca> napsal:
>>
>>> Hello,
>>>
>>> In psql, may I know is there a way/config that idle connections could be
>>> auto closed (but not by pg_cancel_backend command) for specific user(s)
>>> please?
>>>
>>> For example,
>>> select usename, waiting, query_start from pg_stat_activity
>>> where usename like 'connUser1' and
>>> current_query='<IDLE>';
>>>
>>> All connections from connUser1, if idle more than 1 day, psql auto close
>>> them.
>>>
>>
>> What I know, there is not any timeout for this purpose.
>>
>> Maybe pgbouncer can do this https://pgbouncer.github.io/config.html
>>
>> client_idle_timeout
>>
>> Regards
>>
>> Pavel
>>
>>>
>>> Thanks a lot.
>>>
>>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Poty 2019-02-05 18:37:25 Re: Auto close idle connections for specific user (not by pg_cancel command)
Previous Message Thomas Poty 2019-02-05 17:59:31 Re: Auto close idle connections for specific user (not by pg_cancel command)