public inbox for [email protected]  
help / color / mirror / Atom feed
From: David G. Johnston <[email protected]>
To: Yongye Serkfem <[email protected]>
Cc: pgsql-generallists.postgresql.org <[email protected]>
Subject: Re: Deleting idle connections
Date: Mon, 24 Feb 2025 16:05:44 -0700
Message-ID: <CAKFQuwabejBgxy0R3715SuuT0V+dK7_VPUKUcw0eznN8HtCFPw@mail.gmail.com> (raw)
In-Reply-To: <CAAu_hGvBJXOkrjydkOXuDTX8eNMQn9+OMzPT_bcBcT-C9QsPVg@mail.gmail.com>
References: <CAAu_hGvBJXOkrjydkOXuDTX8eNMQn9+OMzPT_bcBcT-C9QsPVg@mail.gmail.com>

On Mon, Feb 24, 2025 at 3:50 PM Yongye Serkfem <[email protected]> wrote:

>
> I am having a series of idle connections and unable to delete them with a
> single command. Any help in realizing this would be greatly appreciated.
>
>
"deleting" really isn't the word used to describe this, terminate, kill, or
disconnect would be better choices.

You should be able to just use pg_terminate_backend in a select query to
accomplish your goal.

https://www.postgresql.org/docs/current/functions-admin.html#FUNCTIONS-ADMIN-SIGNAL

Though usually you are better off fixing the problem at the source; or use
something like pgbouncer.

David J.


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: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Deleting idle connections
  In-Reply-To: <CAKFQuwabejBgxy0R3715SuuT0V+dK7_VPUKUcw0eznN8HtCFPw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox