From 402f87eef7d3fca4eda05cd5687fb10d589773e7 Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Fri, 3 Apr 2026 21:49:24 -0500 Subject: [PATCH v3] remove autoanalyze corner case --- doc/src/sgml/maintenance.sgml | 3 ++- doc/src/sgml/ref/create_table.sgml | 4 +++- src/backend/postmaster/autovacuum.c | 9 --------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml index 0d2a28207ed..412d41c637c 100644 --- a/doc/src/sgml/maintenance.sgml +++ b/doc/src/sgml/maintenance.sgml @@ -531,7 +531,8 @@ autovacuum is invoked on any table that might contain unfrozen rows with XIDs older than the age specified by the configuration parameter . (This will happen even if - autovacuum is disabled.) + autovacuum is disabled. In that case, only VACUUM is + performed; ANALYZE is skipped.) diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 80829b23945..5a1c460bd97 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -1683,7 +1683,9 @@ WITH ( MODULUS numeric_literal, REM and/or ANALYZE operations on this table following the rules discussed in . If false, this table will not be autovacuumed, except to prevent - transaction ID wraparound. See for + transaction ID wraparound. In that case, only VACUUM + is performed; ANALYZE is skipped. + See for more about wraparound prevention. Note that the autovacuum daemon does not run at all (except to prevent transaction ID wraparound) if the diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 8400e6722cc..857e44034d9 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -3329,15 +3329,6 @@ relation_needs_vacanalyze(Oid relid, scores->max = Max(scores->max, scores->anl); if (av_enabled && anltuples > anlthresh) *doanalyze = true; - - /* - * For historical reasons, we analyze even when autovacuum is disabled - * for the table if at risk of wraparound. It's not clear if this is - * intentional, but it has been this way for a very long time, so it - * seems best to avoid changing it without further discussion. - */ - if (force_vacuum && AutoVacuumingActive() && anltuples > anlthresh) - *doanalyze = true; } if (vac_ins_base_thresh >= 0) -- 2.47.3