Add stats_reset to pg_stat_all_{tables,indexes} and related views
authorMichael Paquier <[email protected]>
Mon, 6 Oct 2025 06:31:21 +0000 (15:31 +0900)
committerMichael Paquier <[email protected]>
Mon, 6 Oct 2025 06:31:21 +0000 (15:31 +0900)
commita5b543258aa29e181abe59b3183b685650d24651
tree8b999d91455e1767dce8259428cc70426b7be0f4
parentc173aaff98f898564998c0f5e4df9b6fca8a0f9c
Add stats_reset to pg_stat_all_{tables,indexes} and related views

It is possible to call pg_stat_reset_single_table_counters() on a
relation (index or table) but the reset time was missing from the system
views showing their statistics.

This commit adds the reset time as an attribute of pg_stat_all_tables,
pg_stat_all_indexes, and other relations related to them.

Bump catalog version.
Bump PGSTAT_FILE_FORMAT_ID, as a result of the new field added to
PgStat_StatTabEntry.

Author: Bertrand Drouvot <[email protected]>
Reviewed-by: Sami Imseih <[email protected]>
Reviewed-by: Michael Paquier <[email protected]>
Discussion: https://postgr.es/m/[email protected]
12 files changed:
doc/src/sgml/monitoring.sgml
src/backend/catalog/system_views.sql
src/backend/utils/activity/pgstat.c
src/backend/utils/activity/pgstat_relation.c
src/backend/utils/adt/pgstatfuncs.c
src/include/catalog/catversion.h
src/include/catalog/pg_proc.dat
src/include/pgstat.h
src/include/utils/pgstat_internal.h
src/test/regress/expected/rules.out
src/test/regress/expected/stats.out
src/test/regress/sql/stats.sql