Re: pg_cancel_backend and pg_terminate_backend

From: Wells Oliver <wells(dot)oliver(at)gmail(dot)com>
To: "Wetmore, Matthew (CTR)" <Matthew(dot)Wetmore(at)express-scripts(dot)com>
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: pg_cancel_backend and pg_terminate_backend
Date: 2023-04-19 19:54:00
Message-ID: CAOC+FBV30ewu-E5T2wwFB17zu2+d4GbPcDGV4nnpqgwVDms=ow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Correct. Is there broader risk to the running server and other
connections if a given user's backend is terminated?

On Wed, Apr 19, 2023 at 12:51 PM Wetmore, Matthew (CTR) <
Matthew(dot)Wetmore(at)express-scripts(dot)com> wrote:

> pg_cancel_backend()
>
> A function which cancels a backend's current query
>
>
>
> pg_terminate_backend()
>
> A function which instructs a backend to terminate
>
>
>
> *From:* Wells Oliver <wells(dot)oliver(at)gmail(dot)com>
> *Sent:* Wednesday, April 19, 2023 2:42 PM
> *To:* pgsql-admin <pgsql-admin(at)postgresql(dot)org>
> *Subject:* [EXTERNAL] pg_cancel_backend and pg_terminate_backend
>
>
>
> 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.
>
>
>
> Question: is there any server impact beyond that user's transaction when
> calling pg_terminate_backend? I feel like there _used_ to be, maybe in PG9,
> where I recall maybe seeing a server disconnect or something when using
> terminate.
>
>
>
> Just curious about this approach. Thanks.
>
>
>
> --
>
> Wells Oliver
> wells(dot)oliver(at)gmail(dot)com <wellsoliver(at)gmail(dot)com>
>

--
Wells Oliver
wells(dot)oliver(at)gmail(dot)com <wellsoliver(at)gmail(dot)com>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Thomas Kellerer 2023-04-19 20:10:59 Re: pg_cancel_backend and pg_terminate_backend
Previous Message Wetmore, Matthew (CTR) 2023-04-19 19:53:19 pg_cancel_backend and pg_terminate_backend