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: 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-06-24 05:31:12
Message-ID: ajtroNXfBS/ldtNZ@bdtpg
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2026-06-24 05:40:44 Re: Fix publisher-side sequence permission reporting
Previous Message shveta malik 2026-06-24 05:21:20 Re: [PATCH] Preserve replication origin OIDs in pg_upgrade