Optional skipping of unchanged relations during ANALYZE?

From: VASUKI M <vasukianand0119(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Optional skipping of unchanged relations during ANALYZE?
Date: 2026-01-20 10:24:48
Message-ID: CAE2r8H7+eACA+QxisuPY1jveA=YLuH7CE8F3TedmZfsKdYxOeA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2026-01-20 10:28:34 Re: Row pattern recognition
Previous Message Peter Eisentraut 2026-01-20 10:07:47 Remove redundant AssertVariableIsOfType uses in pg_upgrade