public inbox for [email protected]  
help / color / mirror / Atom feed
From: Shinya Kato <[email protected]>
To: Sami Imseih <[email protected]>
Cc: Nathan Bossart <[email protected]>
Cc: Bharath Rupireddy <[email protected]>
Cc: Robert Treat <[email protected]>
Cc: [email protected]
Cc: pgsql-hackers <[email protected]>
Subject: Re: remove autoanalyze corner case
Date: Mon, 6 Apr 2026 11:32:03 +0900
Message-ID: <CAOzEurQmQwOaqpjhoeBR8SsFJycY2Q4urhCSrX7iXQwR=PiFoQ@mail.gmail.com> (raw)
In-Reply-To: <CAA5RZ0uSwqD8Sh5FZ8Q0QbHqcL2+jhc78ABEoeArVdU6-13U5A@mail.gmail.com>
References: <adB9nSsm_S0D9708@nathan>
	<CAOzEurT6RJdEErH9=8jugMy5UMak1ZPJdY4xQ1pWS4VDwuoraQ@mail.gmail.com>
	<CAA5RZ0uSwqD8Sh5FZ8Q0QbHqcL2+jhc78ABEoeArVdU6-13U5A@mail.gmail.com>

On Mon, Apr 6, 2026 at 7:28 AM Sami Imseih <[email protected]> wrote:
> > +1. I think it might be better to mention this in the documentation to
> > make the behavior explicit. What do you think about stating that an
> > anti-wraparound autovacuum does not perform an ANALYZE, like in the
> > attached patch?
>
> +1 to the additional documentation.
>
> a small nit: We can just say "skipped" and not "still skipped".

Thanks, I've fixed it.

-- 
Best regards,
Shinya Kato
NTT OSS Center


Attachments:

  [application/octet-stream] v3-0001-remove-autoanalyze-corner-case.patch (2.8K, 2-v3-0001-remove-autoanalyze-corner-case.patch)
  download | inline diff:
From 402f87eef7d3fca4eda05cd5687fb10d589773e7 Mon Sep 17 00:00:00 2001
From: Nathan Bossart <[email protected]>
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 <xref
     linkend="guc-autovacuum-freeze-max-age"/>.  (This will happen even if
-    autovacuum is disabled.)
+    autovacuum is disabled.  In that case, only <command>VACUUM</command> is
+    performed; <command>ANALYZE</command> is skipped.)
    </para>
 
    <para>
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 <replaceable class="parameter">numeric_literal</replaceable>, REM
      and/or <command>ANALYZE</command> operations on this table following the rules
      discussed in <xref linkend="autovacuum"/>.
      If false, this table will not be autovacuumed, except to prevent
-     transaction ID wraparound. See <xref linkend="vacuum-for-wraparound"/> for
+     transaction ID wraparound.  In that case, only <command>VACUUM</command>
+     is performed; <command>ANALYZE</command> is skipped.
+     See <xref linkend="vacuum-for-wraparound"/> for
      more about wraparound prevention.
      Note that the autovacuum daemon does not run at all (except to prevent
      transaction ID wraparound) if the <xref linkend="guc-autovacuum"/>
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



reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: remove autoanalyze corner case
  In-Reply-To: <CAOzEurQmQwOaqpjhoeBR8SsFJycY2Q4urhCSrX7iXQwR=PiFoQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox