remove autoanalyze corner case

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Sami Imseih <samimseih(at)gmail(dot)com>
Cc: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Robert Treat <rob(at)xzilla(dot)net>, satyanarlapuram(at)gmail(dot)com, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: remove autoanalyze corner case
Date: 2026-04-04 02:55:25
Message-ID: adB9nSsm_S0D9708@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

(new thread from [0])

On Fri, Apr 03, 2026 at 02:13:16PM -0500, Sami Imseih wrote:
>> * I noticed that if autovacuum decides to force a vacuum for
>> anti-wraparound purposes, it might also decide to analyze the table even if
>> autovacuum is disabled for it. AFAICT this is accidental, but since it's
>> behaved this way since commit 48188e1621 (2006) [0], I am slightly worried
>> that this bug may have become a feature. In 0002, I separated this edge
>> case in the code and added a comment, and I intend to start a new thread
>> about removing it.
>
> hmm yeah, I think this just needs to be documented clearly. I always
> thought it was expected for auto-analyze to run in this case, and I don't
> see why it shouldn't. If this needs to be clarified in docs, we should
> do that in a separate discussion.

Well, autoanalyze only runs in this case if autovacuum is disabled via the
table's autovacuum_enabled reloption and _not_ disabled via the autovacuum
or track_counts GUCs. I think this is pretty clearly unintentional, as I
can find no mention in the code, archives, or docs. And unless I'm missing
something, it's completely unnecessary. So IMHO we should just remove it.

[0] https://postgr.es/m/CAA5RZ0sCRjH3xkHFdSXnKysdMZXFyaS_094%2BK-O_rr4Fkmwc%3DQ%40mail.gmail.com

--
nathan

Attachment Content-Type Size
v1-0001-remove-autoanalyze-corner-case.patch text/plain 1.1 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2026-04-04 03:03:35 Re: Docs: Distinguish table and index storage parameters in CREATE TABLE
Previous Message Nathan Bossart 2026-04-04 02:40:21 Re: Add pg_stat_autovacuum_priority