From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: How to automatically delete idle client connections?
Date: Mon, 21 Jun 2021 16:05:22 -0500
Message-ID: <d2edb633-3add-a9b9-ffa9-3bcfaceecf45@gmail.com> (raw)
In-Reply-To: <CAApHDvqMW-He7TU2iMT0Wi+D4tF2QLmSbpzWQtD7UFWvBHGwaA@mail.gmail.com>
References: <CALKrq=k_QWHBWtDwmE-95mKC8FNX9wOz=1zJMRVwVeLhkRRLGg@mail.gmail.com>
<CAApHDvqMW-He7TU2iMT0Wi+D4tF2QLmSbpzWQtD7UFWvBHGwaA@mail.gmail.com>
On 6/21/21 5:17 AM, David Rowley wrote:
> On Mon, 21 Jun 2021 at 21:59, Yu Watanabe <yu.w.tennis@gmail.com> wrote:
>> I have tried setting idle_in_transaction_session_timeout , however, this does not delete idle sessions.
>>
>> Would there be any expiry settings to delete client idle sessions automatically ?
> There is idle_session_timeout in PostgreSQL 14, but that's not much
> use to you, since a) it's not out yet, and b) you're using 12.
>
> I guess you could do something like:
>
> SELECT pg_terminate_backend(pid) FROM pg_stat_Activity where state =
> 'idle' and state_change < NOW() - INTERVAL '1 hour';
>
> Change '1 hour' to whatever you like and maybe*set up a cron job* to run that.
That's what we did.
--
Angular momentum makes the world go 'round.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: ronljohnsonjr@gmail.com
Subject: Re: How to automatically delete idle client connections?
In-Reply-To: <d2edb633-3add-a9b9-ffa9-3bcfaceecf45@gmail.com>
References: <CALKrq=k_QWHBWtDwmE-95mKC8FNX9wOz=1zJMRVwVeLhkRRLGg@mail.gmail.com> <CAApHDvqMW-He7TU2iMT0Wi+D4tF2QLmSbpzWQtD7UFWvBHGwaA@mail.gmail.com> <d2edb633-3add-a9b9-ffa9-3bcfaceecf45@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox