Re: How to automatically delete idle client connections?

Поиск
Список
Период
Сортировка
От Ron
Тема Re: How to automatically delete idle client connections?
Дата
Msg-id d2edb633-3add-a9b9-ffa9-3bcfaceecf45@gmail.com
обсуждение исходный текст
Ответ на Re: How to automatically delete idle client connections?  (David Rowley <dgrowleyml@gmail.com>)
Ответы Re: How to automatically delete idle client connections?  (Yu Watanabe <yu.w.tennis@gmail.com>)
Список pgsql-general
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.

В списке pgsql-general по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: replace inside regexp_replace
Следующее
От: Venkat Pathi
Дата:
Сообщение: Highly Available Postgres on Kubernetes