On Thu, Mar 04, 2021 at 10:35:19AM +0900, Masahiko Sawada wrote: > > While reviewing "autoanalyze on partitioned table" patch, I realized > that pg_stat_xxx_tables.n_mod_since_analyze is not reset at TRUNCATE. > On the other hand, n_ins_since_vacuum is reset. I think it should be > reset because otherwise we end up unnecessarily triggering autoanalyze > even when the actual number of newly inserted tuples is less than the > autoanalyze thresholds.
Agreed. > I've attached a small patch to fix this. Please review it. The patch looks sensible to me, but the stats.sql (around l. 158) test should be modified to also check for effect on that field.