Re: Add stats_reset to pg_stat_all_tables|indexes and related views - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Add stats_reset to pg_stat_all_tables|indexes and related views
Date
Msg-id aN-ALwvOAGVigw8m@paquier.xyz
Whole thread Raw
In response to Re: Add stats_reset to pg_stat_all_tables|indexes and related views  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
Responses Re: Add stats_reset to pg_stat_all_tables|indexes and related views
List pgsql-hackers
On Fri, Oct 03, 2025 at 05:33:00AM +0000, Bertrand Drouvot wrote:
> On Fri, Oct 03, 2025 at 10:24:39AM +0900, Michael Paquier wrote:
>> Makes sense to me.  This matters in terms of coverage for HEAD,
>> being outside of the scope of this proposal.
>
> Added one test on pg_stat_all_indexes in v2 attached. That's the first test
> on "pg_stat_all_indexes" in .sql files. It just tests the new stats_reset field,
> I think it's sufficient for the purpose of this patch.

But the fact that the reset function is able to work on indexes is
something separate than this patch.  Wouldn't it be better to check
some of the non-timestamp fields of pg_stat_all_indexes with a reset
in a test that applies before the main patch?  That's a minor comment,
sure, but this part feels like a separate item.  So I'd like to
extract that as a patch of its own, then apply it as an independent
piece.

> Yeah, it comes from 083e1b0f27df and the associated discussion is [1]. From what
> I can see, at that time the struct that was holding the table and index stats
> was "PgStat_TableCounts". So the naming "pg_stat_reset_single_table_counters"
> somehow made more sense at that time.

Thanks for the history digging.

I have double-checked the whole patch, at it looks like you have the
right coverage in terms of the docs and the system views, impacting
the set of system views for pg_stat_{all,user,sys}_{tables,indexes},
and same for the pg_statio_* counterparts.  So things look clear here.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Richard Guo
Date:
Subject: Re: Fix incorrect function reference BufFileOpenShared in comment.
Next
From: Fabrice Chapuis
Date:
Subject: Re: Issue with logical replication slot during switchover