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 <[email protected]>
Reviewed-by: Bertrand Drouvot <[email protected]>
Reviewed-by: Sami Imseih <[email protected]>
Reviewed-by: Michael Paquier <[email protected]>
Discussion: https://postgr.es/m/[email protected]

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(-)

Reply via email to