agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add system view pg_stat_kind_info
Date: Thu, 02 Jul 2026 00:34:39 +0000
Message-ID: <E1wf5O4-00111d-0K@gemulon.postgresql.org> (raw)

Add system view pg_stat_kind_info

This commit adds support for pg_stat_kind_info, that exposes at SQL
level data about the statistics kinds registered into a backend:
- Meta-data of a stats kind (built-in or custom, some properties).
- Number of entries, if tracking is enabled.

We have discussed the possibility of more fields (like shared memory
size for a single entry); this adds the minimum agreed on.

This is in spirit similar to pg_get_loaded_modules() for custom stats
kinds, this view providing detailed information about the stats kinds
when registered through shared_preload_libraries.

Bump catalog version.

Author: Tristan Partin <tristan@partin.io>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/DI6OFGHJ1B69.25YVDEP3BABRH@partin.io

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3b066de6c0a1dadbd8bed107e55cae659af0598f

Modified Files
--------------
doc/src/sgml/monitoring.sgml                       | 128 +++++++++++++++++++++
src/backend/catalog/system_views.sql               |  11 ++
src/backend/utils/activity/Makefile                |   1 +
src/backend/utils/activity/meson.build             |   1 +
src/backend/utils/activity/pgstat_kind.c           |  72 ++++++++++++
src/include/catalog/catversion.h                   |   2 +-
src/include/catalog/pg_proc.dat                    |   8 ++
.../test_custom_stats/t/001_custom_stats.pl        |  14 ++-
src/test/regress/expected/rules.out                |   8 ++
src/test/regress/expected/stats.out                |  23 ++++
src/test/regress/sql/stats.sql                     |   7 ++
11 files changed, 273 insertions(+), 2 deletions(-)



Message-ID: <E1wf5O4-00111d-0K@gemulon.postgresql.org>
Permalink:  ../E1wf5O4-00111d-0K@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wf5O4-00111d-0K@gemulon.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Add system view pg_stat_kind_info
  In-Reply-To: <E1wf5O4-00111d-0K@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox