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: Sami Imseih <samimseih@gmail.com>, Tristan Partin <tristan@partin.io>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2026-07-01T08:38:16Z
Lists: pgsql-hackers
Hi, On Wed, Jul 01, 2026 at 04:07:06PM +0900, Michael Paquier wrote: > On Tue, Jun 30, 2026 at 11:17:29PM -0500, Sami Imseih wrote: > >>> IMO, in this case, NULL should be a synonym of "I don't know", which > >>> is what entry_count set to false means. 0 means "I know, there is no > >>> data". I'd be OK with dropping the part about fixed-sized stats where > >>> we enforce 1, and use NULL instead, though. > >> > >> +1, that's also my opinion [1]. > > > > I'm ok with that if others feel this is better. > > Okay, thanks. Let's do so then. Let's also invent a new > pgstat_kind.c in activity/. > > I have been chewing a bit on the comments from Sami, leading to the > following result: > - Switched shared_size to entry_size, for consistency with > entry_count, but I don't agree about the use of shared_data_len. > shared_size is more adapted to me because it has the entry overhead > and the shmem entry header. That's more precise and one does not need > to guess the header size. > - Moved entry_count after entry_size in the list of attributes. > - written_to_file -> write_to_file, same as pgstat_internal.h. > - Moved the new function to a pgstat_kind.c. > - Some extra changes and tweaks to the comments, the docs, some code. > > The attached should do all that, hopefully. Any thoughts? Yeah I also think it does all of that and LGTM. Nit: $ git show | grep -i loaded + One row for each loaded statistics kind, showing information about + loaded statistics kind, including both built-in and custom kinds. + shutdown and reloaded on startup, false if they are kept only in + * Get information about the statistics kinds loaded into the system. + descr => 'statistics: information about loaded statistics kinds', +-- List of loaded statistics kinds. +-- There should be at least one statistics kind loaded +-- List of loaded statistics kinds. +-- There should be at least one statistics kind loaded s/loaded/registered/? 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