Re: pg_cancel_backend and pg_terminate_backend

From: Holger Jakobs <holger(at)jakobs(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: pg_cancel_backend and pg_terminate_backend
Date: 2023-04-19 20:48:18
Message-ID: 961aa7e4-b076-c66b-3c23-32bdd5e352a3@jakobs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Am 19.04.23 um 22:13 schrieb Wells Oliver:
> Because longer idle transactions are used by a bunch of processes, but
> it's a certain group of users I don't want having idle transactions,
> so here we are...
>
> On Wed, Apr 19, 2023 at 1:11 PM Thomas Kellerer <shammat(at)gmx(dot)net> wrote:
>
> Wells Oliver schrieb am 19.04.2023 um 21:41:
> > I usually prefer pg_cancel_backend because it seems.. nicer, but
> > lately I've had a troublesome user who leaves transactions open and
> > I've scripted up a call to pg_terminate_backend after 60 minutes in
> > an idle transaction. It works well.
>
> Why don't you use the idle_in_transaction_session_timeout to do
> this automatically?
>
Actually, you can set this for certain users:

ALTER ROLE alice SET idle_in_transaction_session_timeout TO '100 s';

But the fact that this is possible implies that each session can set
this parameter to any value, AFAIK. Correct me if I'm wrong.

--

Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Wetmore, Matthew (CTR) 2023-04-19 22:04:20 PgAdmin cannot locate my server
Previous Message Benjamin Leis 2023-04-19 20:13:35 Re: pg_cancel_backend and pg_terminate_backend