| From: | Sami Imseih <samimseih(at)gmail(dot)com> |
|---|---|
| To: | Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com> |
| Cc: | VASUKI M <vasukianand0119(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, Robert Treat <rob(at)xzilla(dot)net>, Christoph Berg <myon(at)debian(dot)org> |
| Subject: | Re: Optional skipping of unchanged relations during ANALYZE? |
| Date: | 2026-01-22 22:59:39 |
| Message-ID: | CAA5RZ0tbcydhZ5PwqLMXpMRKuWkwZtvxAiiq6=UH-j2Z7boC2w@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> I can't help but think that this SMART option is not as smart as it
> should be to actually
> be valuable.
>
> I agree that we should never skip a table that has never been
> analyzed. My concern
> is that n_mod_since_analyze == 0 is not very useful.
>
> IMO, for the purpose of ensuring that we never skip relations that have never been analyzed,
> checking last_analyze / last_autoanalyze being NULL seems sufficient and reliable.
edba754f052 introduced --missing-stats-only for vacuumdb. Although
this was intended
for pg_upgrade, it does note in the commit message that "it might be
useful in other situations"
Perhaps, this is one of the situations.
So, instead of a smart mode, maybe we should be thinking about an
ANALYZE (missing_stats_only) option that follows what is done in
vacuumdb; and will skip tables that don't need to be analyzed.
Ultimately vacuumdb can just use this option.
The criteria for tables missing stats is more comprehensive than a simple
last_analyze / last_autoanalyze being NULL.
A followup commit 984d7165dd also mentions:
"
For v19, perhaps we could introduce a simple, inexpensive way to
discover which relations are missing statistics, such as a system
function or view with similar privilege requirements to ANALYZE.
Unfortunately, it is far too late for anything like that in v18.
"
What do you think?
--
Sami Imseih
Amazon Web Services (AWS)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2026-01-22 23:04:29 | Re: Fix rounding method used to compute huge pages |
| Previous Message | Michael Paquier | 2026-01-22 22:54:19 | Re: Add WALRCV_CONNECTING state to walreceiver |