>> I agree with this, but I think it's more than just tables that have >> not been analyzed. >> What if a new column is added after the last (auto)analyze. Would we not >> want to >> trigger an analyze in that case? >>
> Well, I don't know that we are "triggering" anything, but this is > definitely a case where we have "missing stats". > When MISSING_STATS is passed, we attempt to analyze only tables that > have missing stats, essentially implementing a version of > --missing-stats-only I also want to do add that the benefit of implementing a --missing-stats fo ANALYZE is that the timestamps in pg_stat_all_tables are cleared on crash recovery, but pg_statistic is obviously persistent. So it is better to look directly there as --missing-stats-only does for vacuumdb. unfortunately, this is not the case for n_mod_since_analyze, because that does not survive. There is discussion about improving this situation however [0]. [0] https://www.postgresql.org/message-id/[email protected] -- Sami Imseih Amazon Web Services (AWS)
