Re: Add connection active, idle time to pg_stat_activity

Andrey Borodin <amborodin86@gmail.com>

From: Andrey Borodin <amborodin86@gmail.com>
To: Sergey Dudoladov <sergey.dudoladov@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, "David G. Johnston" <david.g.johnston@gmail.com>, Andres Freund <andres@anarazel.de>, torikoshia <torikoshia@oss.nttdata.com>, "Drouvot, Bertrand" <bdrouvot@amazon.com>, Julien Rouhaud <rjuju123@gmail.com>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>, Kuntal Ghosh <kuntalghosh.2007@gmail.com>, Rafia Sabih <rafia.pghackers@gmail.com>
Date: 2023-02-16T21:37:41Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Remove unstable pg_amcheck tests.

On Wed, Feb 1, 2023 at 12:46 PM Sergey Dudoladov
<sergey.dudoladov@gmail.com> wrote:
>
> I've sketched the first version of a patch to add pg_stat_session.
> Please review this early version.

Hi Sergey!

I've taken a look into the patch and got some notes.
1. It is hard to understand what fastpath backend state is. What do
fastpath metrics mean for a user?
2. Anyway, the path "if (PGSTAT_IS_FASTPATH(beentry))" seems
unreachable to me. I'm a bit surprised that compilers do not produce
warnings about it. Maybe I'm just wrong.
3. Tests do not check any incrementation logic. I think we can have
some test that verifies delta for select some_counter from
pg_stat_session where pid = pg_backend_pid();
4. Macroses like PGSTAT_IS_RUNNING do not look like net win in code
readability and PGSTAT prefix have no semantic load.


That's all I've found so far. Thank you!

Best regards, Andrey Borodin.

PS. We were doing on-air review session [0], I hope Nik will chime-in
with "usability part of a review".

[0] https://youtu.be/vTV8XhWf3mo?t=2404