Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tmhWt-009EAo-Mh for pgsql-general@arkaria.postgresql.org; Mon, 24 Feb 2025 23:06:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tmhWs-00ATbs-OY for pgsql-general@arkaria.postgresql.org; Mon, 24 Feb 2025 23:06:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tmhWs-00ATbN-Dz for pgsql-general@lists.postgresql.org; Mon, 24 Feb 2025 23:06:26 +0000 Received: from mail-oa1-x31.google.com ([2001:4860:4864:20::31]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tmhWp-000cuE-1q for pgsql-general@lists.postgresql.org; Mon, 24 Feb 2025 23:06:25 +0000 Received: by mail-oa1-x31.google.com with SMTP id 586e51a60fabf-2bcca6aa8e1so910722fac.1 for ; Mon, 24 Feb 2025 15:06:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740438381; x=1741043181; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=3cqFnpJ/AZ0mh++2qOtFKGlXvSDQt1a0wcdFlcwbzbs=; b=FC4BdqBNqKiktaulHAv0VxzlCS77axbO61wuLkfQbn1v6+9o2X4OJc9pN7fls8xLp7 UvAEZNGYNou86j7tP9vt87bzDUY5aJdnYxvXIbbp98nFSa4rJz37vYQ0aQtxAb5rCpjE QeH/tqfrro+3aIvUiEV0pXAb92CJnJnmKITvaXHBNEYvAEjQwOYkxWDHsSctsDiPYNht Hq0L4WzxdBbhwU90EDEYxJ31hWIWuKCZo/mKWEncDlkQuQY4AKEUAzFoWOyqbbfydZ9m zB9ED9hm/ouWaZOG71ChSXqZko4UnsC7udh5KyMkV8J83dqkaOeFdbrOXjd15FpkhaH2 ABAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740438381; x=1741043181; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3cqFnpJ/AZ0mh++2qOtFKGlXvSDQt1a0wcdFlcwbzbs=; b=blMDvcGiEL/N7YXbjQFKHA4re7mKUgEx456mlxsImsNdoSCEAw97vyncWT4cZEr5vR Zg71W8J+O6Vu+gY7pGAInw53UHswHOhe+ECs1v+GtzpigPX/KQdE74m0UeZ+O2Hh4Nor Dx7k4al/U5siYKslcYYs5yk6JZ6gDMNc5+1fDFZUBrSGOOlpGIWf8xSQfDriE3Co0UEt XDOtLpIwX+zIw7uY8NNW1tqAynjl/CkMcLj9ILUWRJunGGwdkVchay4dR2eSwNCs38k9 tDpS57/bLpssvB1guuQ2A6T07HoHXEYjp4HHWxPnfTXsn1yJa5ZlJmF0gL695pNIyuot M5jg== X-Gm-Message-State: AOJu0YzmPsX/6hz6dNN+fAVQA+ZfjnrIeMMCAZkHVdNqYsuuC74YcOMF C0zGxDhX373cLl+Wi0klxiGGc/heZq8CuQKnDB41QNSn8vStKyszSOeXggRDBYJpdjDITzEMNlN uMF9+QaRAEd0C3cw3ZwT9NO64LDk= X-Gm-Gg: ASbGnct5SD1Dm9KTTuWerl8SNSCqIyHme6selPQtf78mCwrSgHbUavndVOoGiAmuaID IMp01/xM84oIT0q9FJeIRKGZXdtueuXwP2URH1puGTaYn1mJQSBffcgEYb5YTKdwbHWaTHzLsDq 2QWHKi5g== X-Google-Smtp-Source: AGHT+IHUMkNTfw5b5a0cy/dfsWtTP2RqlMVDrBle27MBpncSTw+WwJxVv7obz62lxmowsk8zCfHV+Xb5VXkhvBHYqnY= X-Received: by 2002:a05:6808:384a:b0:3f4:ad3:d666 with SMTP id 5614622812f47-3f540ee6846mr968550b6e.21.1740438381439; Mon, 24 Feb 2025 15:06:21 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: "David G. Johnston" Date: Mon, 24 Feb 2025 16:05:44 -0700 X-Gm-Features: AWEUYZkMfwyouTigiQ8jmOAWhiElY9mdcpD_1-l9yoXDHqZhRsdWVftaZlLANog Message-ID: Subject: Re: Deleting idle connections To: Yongye Serkfem Cc: "pgsql-generallists.postgresql.org" Content-Type: multipart/alternative; boundary="0000000000007ab0ef062eeb6382" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000007ab0ef062eeb6382 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Feb 24, 2025 at 3:50=E2=80=AFPM Yongye Serkfem = 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-ADMI= N-SIGNAL Though usually you are better off fixing the problem at the source; or use something like pgbouncer. David J. --0000000000007ab0ef062eeb6382 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Feb 24, 2025 at 3:50=E2=80=AFPM Yongye Serkfem <= ;yserkfem@gmail.com> wrote:

I am havi= ng a series of idle connections and unable to delete them with a single com= mand. Any help in realizing this would be greatly appreciated.

"deleting" really is= n't the word used to describe this, terminate, kill, or disconnect woul= d be better choices.

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

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

David J.

--0000000000007ab0ef062eeb6382--