Add stats_reset to pg_stat_all_{tables,indexes} and related views
Michael Paquier <michael@paquier.xyz>
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 <bertranddrouvot.pg@gmail.com>
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aN8l182jKxEq1h9f@paquier.xyz
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/monitoring.sgml | modified | +36 −0 |
| src/backend/catalog/system_views.sql | modified | +8 −4 |
| src/backend/utils/activity/pgstat.c | modified | +1 −0 |
| src/backend/utils/activity/pgstat_relation.c | modified | +6 −0 |
| src/backend/utils/adt/pgstatfuncs.c | modified | +3 −0 |
| src/include/catalog/catversion.h | modified | +1 −1 |
| src/include/catalog/pg_proc.dat | modified | +4 −0 |
| src/include/pgstat.h | modified | +3 −1 |
| src/include/utils/pgstat_internal.h | modified | +1 −0 |
| src/test/regress/expected/rules.out | modified | +24 −12 |
| src/test/regress/expected/stats.out | modified | +22 −12 |
| src/test/regress/sql/stats.sql | modified | +8 −3 |
Discussion
- Add stats_reset to pg_stat_all_tables|indexes and related views 13 messages · 2025-10-02 → 2025-10-08