pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Rajesh Kumar <rajeshkumar.dba09@gmail.com>
Cc: Rui DeSousa <rui@crazybean.net>
Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>
Subject: Re: Handling idle connections
Date: Sun, 24 Sep 2023 23:34:54 -0400
Message-ID: <69504.1695612894@sss.pgh.pa.us> (raw)
In-Reply-To: <CAJk5AtaSH0n_Uc3R2JpfirW0MhHt1SxZNkB-ZuJmTR6VcfALGw@mail.gmail.com>
References: <CAJk5Ata=NXO46e7RcS-CxEXvroz=-fojS+XzpW-Bty+G-sx51A@mail.gmail.com>
	<AB0BD6D8-DFE1-4918-9AF6-0A9A1ED5CEBE@crazybean.net>
	<CAJk5AtaSH0n_Uc3R2JpfirW0MhHt1SxZNkB-ZuJmTR6VcfALGw@mail.gmail.com>

Rajesh Kumar <rajeshkumar.dba09@gmail.com> writes:
> 1. I see lot of idle connections where application_name is blank and also
> query is blank, i am identifying only with user. In this case how do I
> identify which application is using idle connection?

If pg_stat_activity.query is empty, then that is a connection that has
*never* issued a query (because once it has, the query column reflects
the last query even when the session is idle).  So apparently you have
a rather broken application that connects and then does nothing.

I'd suggest fixing the client side so that it sets application_name to
something that would help identify the situation.  If the client is
libpq-based, you might be able to do this by setting the PGAPPNAME
environment variable in an invoking script, rather than modifying
any low-level code.

			regards, tom lane





view thread (15+ messages)  latest in thread

Message-ID: <69504.1695612894@sss.pgh.pa.us>
Permalink:  ../69504.1695612894@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/69504.1695612894@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, rajeshkumar.dba09@gmail.com, rui@crazybean.net, pgsql-admin@lists.postgresql.org
  Subject: Re: Handling idle connections
  In-Reply-To: <69504.1695612894@sss.pgh.pa.us>

* 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