On Fri, 6 Aug 2021 at 13:56, Sadhuprasad Patro <b.sa...@gmail.com> wrote: > > Hi, > > The call to “pg_stat_reset“ does reset all the statistics data for > tables belonging to the current database but does not take care of > shared tables e.g pg_attribute. Similarly to reset the statistics at > table level, the call to “pg_stat_reset_single_table_counters“ does > not take care of shared tables. > > When we reset all the statistics using the call “pg_stat_reset”, the > postgres process internally makes calls to “ > pgstat_recv_resetcounter“, which resets the statistics of all the > tables of the current database. But not resetting the statistics of > shared objects using database ID as 'InvalidOid'. > > The same fix is made in the internal function > “pgstat_recv_resetsinglecounter“ to reset the statistics for the > shared table for the call "pg_stat_reset_single_table_counters". >
Hi Sadhu, I was looking into the patch. I will look more in the coming days. I have below comments. 1. Please can you share the test case to reproduce the issue and please add the test case in patch. 2. diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c index 56755cb92b..f272931276 100644 --- a/src/backend/postmaster/pgstat.c +++ b/src/backend/postmaster/pgstat.c @@ -5092,7 +5092,6 @@ pgstat_recv_resetcounter(PgStat_MsgResetcounter *msg, int len) * Lookup the database in the hashtable. Nothing to do if not there. */ dbentry = pgstat_get_db_entry(msg->m_databaseid, false); - if (!dbentry) return; I think, by mistake, you removed one line in the patch. -- Thanks and Regards Mahendra Singh Thalor EnterpriseDB: http://www.enterprisedb.com