张连壮 wrote: > it reset statistics for a single table and update the column stats_reset of > pg_stat_database. > but i think that stats_reset shoud be database-level statistics, a single > table should not update the column stats_reset.
This patch is a current CF entry at https://commitfest.postgresql.org/23/2116/ The issue it addresses was submitted as bug #15801: https://www.postgresql.org/message-id/flat/15801-21c7fbff08b6c10c%40postgresql.org As mentioned in the discussion on -bugs, it's not necessarily a bug because: * the comment in the code specifically states that it's intentional, in pgstat_recv_resetsinglecounter(): /* Set the reset timestamp for the whole database */ dbentry->stat_reset_timestamp = GetCurrentTimestamp(); * the commit message also states the same: commit 4c468b37a281941afd3bf61c782b20def8c17047 Author: Magnus Hagander <mag...@hagander.net> Date: Thu Feb 10 15:09:35 2011 +0100 Track last time for statistics reset on databases and bgwriter Tracks one counter for each database, which is reset whenever the statistics for any individual object inside the database is reset, and one counter for the background writer. Tomas Vondra, reviewed by Greg Smith I can understand why you'd want that resetting the stats for a single object would not reset the per-database timestamp, but this would revert a 8+ years old decision that seems intentional and has apparently not been criticized since then (based on searching for pg_stat_reset_single_table_counters in the archives) . More opinions are probably needed in favor of this change (or against, in which case the fate of the patch might be a rejection). Best regards, -- Daniel Vérité PostgreSQL-powered mailer: http://www.manitou-mail.org Twitter: @DanielVerite