Re: Handling idle connections - Mailing list pgsql-admin

From Tom Lane
Subject Re: Handling idle connections
Date
Msg-id 69504.1695612894@sss.pgh.pa.us
Whole thread Raw
In response to Re: Handling idle connections  (Rajesh Kumar <rajeshkumar.dba09@gmail.com>)
List pgsql-admin
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



pgsql-admin by date:

Previous
From: Rui DeSousa
Date:
Subject: Re: Handling idle connections
Next
From: mu88
Date:
Subject: Seed pgAdmin roles with Active Directory groups when using Docker