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

From VASUKI M
Subject Optional skipping of unchanged relations during ANALYZE?
Date
Msg-id CAE2r8H7+eACA+QxisuPY1jveA=YLuH7CE8F3TedmZfsKdYxOeA@mail.gmail.com
Whole thread Raw
Responses Re: Optional skipping of unchanged relations during ANALYZE?
Re: Optional skipping of unchanged relations during ANALYZE?
Re: Optional skipping of unchanged relations during ANALYZE?
List pgsql-hackers
Hi Hackers,

I’m planning to work on a small improvement around ANALYZE behavior and
wanted to ask the community for guidance before proceeding.

Currently, when ANALYZE is run over many relations, it analyzes all
eligible tables even if some of them have not changed since their last
ANALYZE. In environments with many mostly-static tables, this can lead
to repeated work with little benefit.

I’m considering working on an optional mode where ANALYZE would skip
relations that have not been modified since their last analyze, based
on existing pg_stat counters (for example, mod_since_analyze = 0).

Before moving forward, I’d like to understand:

--whether this aligns with PostgreSQL’s statistics and planner design,

--if there are reasons ANALYZE should always re-run even for unchanged
relations,

--and whether such behavior would be acceptable if it were strictly
opt-in.

Any feedback, concerns, or pointers would be very helpful.

Thanks,
Vasuki M
C-DAC,Chennai

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Remove redundant AssertVariableIsOfType uses in pg_upgrade
Next
From: Tatsuo Ishii
Date:
Subject: Re: Row pattern recognition