pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add stats_reset to pg_stat_all_{tables,indexes} and related view
Date: Mon, 06 Oct 2025 06:31:46 +0000
Message-ID: <E1v5el8-000ITY-0r@gemulon.postgresql.org> (raw)

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a5b543258aa29e181abe59b3183b685650d24651

Modified Files
--------------
doc/src/sgml/monitoring.sgml                 | 36 ++++++++++++++++++++++++++++
src/backend/catalog/system_views.sql         | 12 ++++++----
src/backend/utils/activity/pgstat.c          |  1 +
src/backend/utils/activity/pgstat_relation.c |  6 +++++
src/backend/utils/adt/pgstatfuncs.c          |  3 +++
src/include/catalog/catversion.h             |  2 +-
src/include/catalog/pg_proc.dat              |  4 ++++
src/include/pgstat.h                         |  4 +++-
src/include/utils/pgstat_internal.h          |  1 +
src/test/regress/expected/rules.out          | 36 ++++++++++++++++++----------
src/test/regress/expected/stats.out          | 34 ++++++++++++++++----------
src/test/regress/sql/stats.sql               | 11 ++++++---
12 files changed, 117 insertions(+), 33 deletions(-)



Message-ID: <E1v5el8-000ITY-0r@gemulon.postgresql.org>
Permalink:  ../E1v5el8-000ITY-0r@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1v5el8-000ITY-0r@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 stats_reset to pg_stat_all_{tables,indexes} and related view
  In-Reply-To: <E1v5el8-000ITY-0r@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 DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox