Re: Add pg_stat_kind_info system view
Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Tristan Partin <tristan@partin.io>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2026-06-24T05:31:12Z
Lists: pgsql-hackers
Hi, On Wed, Jun 24, 2026 at 01:12:09PM +0900, Michael Paquier wrote: > On Thu, Jun 18, 2026 at 04:54:36PM +0000, Tristan Partin wrote: > > On Mon Jun 8, 2026 at 12:16 AM UTC, Michael Paquier wrote: > >> On Thu, Jun 04, 2026 at 04:59:00PM +0000, Tristan Partin wrote: > >>> I believe that I also captured this correctly in v2. > >> > >> No v2 of the patch has been attached. :D Thanks for the patch, that looks like an useful addition to me. A few comments: === 1 +++ b/src/backend/utils/adt/pgstatfuncs.c @@ -30,6 +30,8 @@ #include "storage/procarray.h" #include "utils/acl.h" #include "utils/builtins.h" +#include "utils/pgstat_internal.h" But header in pgstat_internal.h mentions: " * Definitions for the PostgreSQL cumulative statistics system that should * only be needed by files implementing statistics support (rather than ones * reporting / querying stats). " So it looks like that we are breaking this convention here. Maybe add helper function(s)? === 2 + /* For fixed-amount kinds, count is always 1. The entry is stored in + * PgStat_ShmemControl. If it is not a fixed-amount, then report the + * count of entries if tracked, or NULL if not tracked. + */ comment style is not right. === 3 + /* For fixed-amount kinds, count is always 1. Why not report NULL for fixed-amount kinds too? The track_entry_count field is documented as being for variable-numbered stats only, so the count would only be reported for custom variable-numbered kinds that set it to true. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add system view pg_stat_kind_info
- 3b066de6c0a1 master landed
-
Introduce pluggable APIs for Cumulative Statistics
- 7949d9594582 18.0 cited