Re: Add connection active, idle time to pg_stat_activity
Sergey Dudoladov <sergey.dudoladov@gmail.com>
From: Sergey Dudoladov <sergey.dudoladov@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Julien Rouhaud <rjuju123@gmail.com>,
Kyotaro Horiguchi <horikyota.ntt@gmail.com>, Kuntal Ghosh <kuntalghosh.2007@gmail.com>,
Rafia Sabih <rafia.pghackers@gmail.com>
Date: 2022-02-04T09:58:24Z
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 →
-
Remove unstable pg_amcheck tests.
- cd3f429d9565 15.0 cited
Attachments
- v8_add_idle_active_time.patch (text/x-patch) patch v8
Hi, > > Could you please elaborate on this idea ? > > So we have pgStatActiveTime and pgStatIdleInTransactionTime ultimately > > used to report respective metrics in pg_stat_database. > > Now beentry's st_total_active_time / st_total_transaction_idle_time > > duplicates this info, so one may get rid of pgStat*Time counters. Is > > the idea to report instead of them at every tabstat reporting the > > difference between the last memorized value of st_total_*_time and > > its current value ? > > Exactly. The attached first diff is the schetch of that. This diff actually adds more code than it removes and somewhat bloats the patch. I decided to incorporate it anyway because the diff explicitly shows that time differences since the last report are send to the statistics collector,which is not immediately evident from the existing PgStat*Time counters. That point may be worth further discussion though. > And, it seems like I forgot to mention this, but as Kuntal suggested > (in a different context and objective, though) upthraed, I think that > we can show realtime values in the two time fields by adding the time > of the current state. See the attached second diff. That is exactly what we need in our infra, also included into the patch. @Kyotaro Horiguchi Thank you for the contribution. I included both of your diffs with minor changes. Should I add you to the authors of the patch given that now half of it is basically your code ? Regards, Sergey