Re: Add connection active, idle time to pg_stat_activity

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Sergey Dudoladov <sergey(dot)dudoladov(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, torikoshia <torikoshia(at)oss(dot)nttdata(dot)com>, "Drouvot, Bertrand" <bdrouvot(at)amazon(dot)com>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Kuntal Ghosh <kuntalghosh(dot)2007(at)gmail(dot)com>, Rafia Sabih <rafia(dot)pghackers(at)gmail(dot)com>
Subject: Re: Add connection active, idle time to pg_stat_activity
Date: 2022-11-09 02:25:27
Message-ID: CAKFQuwYeprTF-sxd-4uDKH9CmNecL-N=6wz4TM-X0noXAg9Z8A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Nov 8, 2022 at 6:56 PM Andres Freund <andres(at)anarazel(dot)de> wrote:

>
> Separately from that, I'm a bit worried about starting to add accumulative
> counters to pg_stat_activity. It's already gotten hard to use interactively
> due to the number of columns - and why stop with the columns you suggest?
> Why
> not show e.g. the total number of reads/writes, tuples inserted / deleted,
> etc. as well?
>
> I wonder if we shouldn't add a pg_stat_session or such for per-connection
> counters that show not the current state, but accumulated per-session
> state.
>
>
I would much rather go down this route than make the existing table wider.

pg_stat_activity_state_duration (this patch) [the table - for a given
backend - would be empty if track_activities is off]
pg_stat_activity_bandwidth_usage (if someone feels like implementing the
other items you mention)

I'm not really buying into the idea of having multiple states sum their
times together. I would expect one column per state. Actually two,
because I also suggest that not only is the duration recorded, but a
counter be incremented each time a given state becomes the currently active
state. Seems like having access to a divisor of some form may be useful.

So 10 columns of data plus pid to join back to pg_stat_activity proper.

David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-11-09 02:28:08 Re: allow segment size to be set to < 1GiB
Previous Message David Rowley 2022-11-09 01:58:53 Re: Add proper planner support for ORDER BY / DISTINCT aggregates