pgsql: Add system view pg_stat_kind_info

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add system view pg_stat_kind_info
Date: 2026-07-02 00:34:39
Message-ID: E1wf5O4-00111d-0K@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)partin(dot)io>
Reviewed-by: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Reviewed-by: Sami Imseih <samimseih(at)gmail(dot)com>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Kapila 2026-07-02 02:57:31 pgsql: Allow logical replication conflicts to be logged to a table.
Previous Message Masahiko Sawada 2026-07-01 18:43:14 pgsql: Add min() and max() aggregate support for uuid.