Re: Fix pg_stat_reset_single_table_counters function - Mailing list pgsql-hackers

From Masahiro Ikeda
Subject Re: Fix pg_stat_reset_single_table_counters function
Date
Msg-id 97c9f7a46681f051b1356e2987c3fd6c@oss.nttdata.com
Whole thread Raw
In response to Re: Fix pg_stat_reset_single_table_counters function  (Andres Freund <andres@anarazel.de>)
Responses Re: Fix pg_stat_reset_single_table_counters function
List pgsql-hackers
Hi,

On 2023-08-13 04:12, Andres Freund wrote:
> On 2023-08-10 17:48:10 +0900, Masahiko Sawada wrote:
>> Good catch! I've confirmed that the issue has been fixed by your 
>> patch.
> 
> Indeed.

Thanks for your responses!

>> However, I'm not sure the added regression tests are stable since
>> autovacuum workers may scan the pg_database and increment the
>> statistics after resetting the stats.
> 
> What about updating the table and checking the update count is reset? 
> That'd
> not be reset by autovacuum.

Yes. I confirmed that the stats are incremented by autovacuum as you 
said.

I updated the patch to v3.
* remove the code to bump the CATALOG_VERSION_NO because I misunderstood
* change the test logic to check the update count instead of scan count

I changed the table to check the stats from pg_database to 
pg_shdescription
because the stats can update via the SQL interface COMMENT command.

Regards,
-- 
Masahiro Ikeda
NTT DATA CORPORATION
Attachment

pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Extract numeric filed in JSONB more effectively
Next
From: Peter Eisentraut
Date:
Subject: Re: pgsql: Allow tailoring of ICU locales with custom rules