Re: Deleting idle connections

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Yongye Serkfem <yserkfem(at)gmail(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Deleting idle connections
Date: 2025-02-24 23:05:44
Message-ID: CAKFQuwabejBgxy0R3715SuuT0V+dK7_VPUKUcw0eznN8HtCFPw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Feb 24, 2025 at 3:50 PM Yongye Serkfem <yserkfem(at)gmail(dot)com> 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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2025-02-24 23:12:13 Re: Deleting idle connections
Previous Message Yongye Serkfem 2025-02-24 22:49:51 Deleting idle connections