Re: [PATCH] Connection time for \conninfo

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Rodrigo Ramírez Norambuena <decipher(dot)hk(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Connection time for \conninfo
Date: 2019-09-04 15:04:03
Message-ID: 20190904150403.GA27872@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019-Sep-04, Michael Paquier wrote:

> On Tue, Sep 03, 2019 at 10:13:57PM -0400, Rodrigo Ramírez Norambuena wrote:
> > I've work in the a little patch to add into the \conninfo of psql
> > command the connection time against a server backend
> >
> > Maybe could add after, the precheck to if the connection is alive.
> > I've take first look to the pqPacketSend, my idea is send a ECHO
> > packet over to the database connection. If someone has a better idea
> > it would be great to know.
>
> You can do basically the same thing by looking at
> pg_stat_activity.backend_start and compare it with the clock
> timestamp. Doing it at SQL level the way you want has also the
> advantage to offer you a modular format output.

Hmm, couldn't you say the same about the other details that \conninfo
gives? You can get them from pg_stat_activity or pg_stat_ssl, yet
they're still shown \conninfo for convenience. Surely we don't want to
remove everything from \conninfo and tell users to query the stat views
instead.

The only thing that seems wrong about this proposal is that the time
format is a bit too verbose. I would have it do "N days 12:23:34".

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2019-09-04 15:15:35 auxiliary processes in pg_stat_ssl
Previous Message Tom Lane 2019-09-04 14:59:25 Re: Unexpected "shared memory block is still in use"