Re: Handling idle connections

From: Rui DeSousa <rui(at)crazybean(dot)net>
To: Rajesh Kumar <rajeshkumar(dot)dba09(at)gmail(dot)com>
Cc: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Handling idle connections
Date: 2023-09-25 03:10:16
Message-ID: A105716B-FE6A-40A8-8117-F1DACB2C9F56@crazybean.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

> On Sep 24, 2023, at 6:07 PM, Rajesh Kumar <rajeshkumar(dot)dba09(at)gmail(dot)com> wrote:
>
> Yes, i came here only after doing a lot of research on internet. I am doing most of these things already.
>
> I need help on two things now.
>
> 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?

Use client_addr and client_port from pg_stat_activity to identify the application. The client_addr will give the host it’s connecting from and the port will allow you to determine the process on the client host.

> 2. How to set up TCP/IP timeouts? I saw some parameters like tcp_user_timeout, tcp_keepalives_idle etc or how?

I meant to say TCP/IP keep alive. There are different ways and options to set keep alive and some are OS dependent.

Here’ s an article that should help you get started:

https://www.cybertec-postgresql.com/en/tcp-keepalive-for-a-better-postgresql-experience/ <https://www.cybertec-postgresql.com/en/tcp-keepalive-for-a-better-postgresql-experience/>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2023-09-25 03:34:54 Re: Handling idle connections
Previous Message Rajesh Kumar 2023-09-24 22:07:25 Re: Handling idle connections