Re: Add pg_stat_kind_info system view

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Sami Imseih <samimseih(at)gmail(dot)com>, Tristan Partin <tristan(at)partin(dot)io>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add pg_stat_kind_info system view
Date: 2026-07-01 08:38:16
Message-ID: akTR+NWGNnJuQS4o@bdtpg
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2026-07-01 09:05:23 Re: Fix floating-point noise in pg_stat_us_to_ms()
Previous Message Shlok Kyal 2026-07-01 08:30:06 Re: Support EXCEPT for ALL SEQUENCES publications