Re: Optional skipping of unchanged relations during ANALYZE? - Mailing list pgsql-hackers

From Sami Imseih
Subject Re: Optional skipping of unchanged relations during ANALYZE?
Date
Msg-id CAA5RZ0t=fGScwGL9=_HJzXf3808-U4zqne+qAob6R2PYcj-9YA@mail.gmail.com
Whole thread Raw
In response to Re: Optional skipping of unchanged relations during ANALYZE?  (Sami Imseih <samimseih@gmail.com>)
Responses Re: Optional skipping of unchanged relations during ANALYZE?
List pgsql-hackers
>> 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/20240607033806.6gwgolihss72cj6r@awork3.anarazel.de

--
Sami Imseih
Amazon Web Services (AWS)



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: alignas (C11)
Next
From: "Jelte Fennema-Nio"
Date:
Subject: Re: Make copyObject work in C++