pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Wetmore, Matthew (CTR) <Matthew.Wetmore@express-scripts.com>
To: Wells Oliver <wells.oliver@gmail.com>
To: pgsql-admin <pgsql-admin@postgresql.org>
Subject: pg_cancel_backend and pg_terminate_backend
Date: Wed, 19 Apr 2023 19:51:17 +0000
Message-ID: <83b2ee4970954aebb6dbe7d8f5f6e87b@express-scripts.com> (raw)
In-Reply-To: <CAOC+FBVZFVSF1ntpf7UwQ==YA1KaerSrH0_BH+pmczEp88r2Ug@mail.gmail.com>
References: <CAOC+FBVZFVSF1ntpf7UwQ==YA1KaerSrH0_BH+pmczEp88r2Ug@mail.gmail.com>

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.oliver@gmail.com>
Sent: Wednesday, April 19, 2023 2:42 PM
To: pgsql-admin <pgsql-admin@postgresql.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.oliver@gmail.com<mailto:wellsoliver@gmail.com>


view thread (11+ messages)  latest in thread

Message-ID: <83b2ee4970954aebb6dbe7d8f5f6e87b@express-scripts.com>
Permalink:  ../83b2ee4970954aebb6dbe7d8f5f6e87b@express-scripts.com/
Also on:    postgresql.org/message-id/83b2ee4970954aebb6dbe7d8f5f6e87b@express-scripts.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: Matthew.Wetmore@express-scripts.com, wells.oliver@gmail.com
  Subject: Re: pg_cancel_backend and pg_terminate_backend
  In-Reply-To: <83b2ee4970954aebb6dbe7d8f5f6e87b@express-scripts.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