Re: Add connection active, idle time to pg_stat_activity

From: Sergey Dudoladov <sergey(dot)dudoladov(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Andrey Borodin <amborodin86(at)gmail(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, 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: 2023-06-14 05:50:35
Message-ID: CAA8Fd-pk89q=spKJ1vDeO2GPwEQme5Ub34v7B8XrpCE_sEOtZA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello hackers,

Andrey and Nik, thank you for selecting this patch for review in
Postgres Hacking 101: I've modified the patch based both on your email
and the video.

1. Session statistics is now collected only for client backends. PG
internal processes like wal sender seem to stop sending statistics
after they have entered their respective main loops.
2. Fastpath state now counts towards the running state. I think this
special case does not justify tracking two extra numbers for every
client backend.
3. I've added a small test for pg_stat_session similar to other tests
in src/test/regress/sql/sysviews.sql
4. Here are the pb_bench results requested in the video review:

Conditions: no assertions, number of transactions = 1000
The query: SELECT generate_series(1, 10000000) OFFSET 10000000;
With pg_stat_session:
latency average = 324.480 ms
tps = 3.081857 (without initial connection time)

Without pg_stat_session:
latency average = 327.370 ms
tps = 3.054651 (without initial connection time)

Regards,
Sergey

Attachment Content-Type Size
0002-Add-pg_stat_session.patch text/x-patch 19.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2023-06-14 06:23:07 Re: [PoC] Improve dead tuple storage for lazy vacuum
Previous Message Konstantin Knizhnik 2023-06-14 05:46:05 Re: Let's make PostgreSQL multi-threaded