pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: MichaelDBA <MichaelDBA@sqlexec.com>
To: Wells Oliver <wells.oliver@gmail.com>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: pg_cancel_backend and pg_terminate_backend
Date: Wed, 19 Apr 2023 15:46:29 -0400
Message-ID: <8d16a5ba-a4bc-f139-5f25-daef5ae85340@sqlexec.com> (raw)
In-Reply-To: <CAOC+FBVZFVSF1ntpf7UwQ==YA1KaerSrH0_BH+pmczEp88r2Ug@mail.gmail.com>
References: <CAOC+FBVZFVSF1ntpf7UwQ==YA1KaerSrH0_BH+pmczEp88r2Ug@mail.gmail.com>

My experience with the older PG versions is that I couldn't stop a query 
sometimes with pg_cancel_backend, so I had to resort to 
pg_terminate_backend.

Regards,
Michael Vitale


Wells Oliver wrote on 4/19/2023 3:41 PM:
> 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.oliver@gmail.com <mailto:wellsoliver@gmail.com>


Regards,

Michael Vitale

Michaeldba@sqlexec.com <mailto:michaelvitale@sqlexec.com>

703-600-9343

Attachments:

  [image/jpeg] pgadvanced3.jpg (20.6K, ../8d16a5ba-a4bc-f139-5f25-daef5ae85340@sqlexec.com/3-pgadvanced3.jpg)
  download | view image

view thread (11+ messages)  latest in thread

Message-ID: <8d16a5ba-a4bc-f139-5f25-daef5ae85340@sqlexec.com>
Permalink:  ../8d16a5ba-a4bc-f139-5f25-daef5ae85340@sqlexec.com/
Also on:    postgresql.org/message-id/8d16a5ba-a4bc-f139-5f25-daef5ae85340@sqlexec.com

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: MichaelDBA@sqlexec.com, wells.oliver@gmail.com
  Subject: Re: pg_cancel_backend and pg_terminate_backend
  In-Reply-To: <8d16a5ba-a4bc-f139-5f25-daef5ae85340@sqlexec.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