Add autovacuum_warning to surface concurrent vacuum collisions

From: Shinya Kato <shinya11(dot)kato(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Add autovacuum_warning to surface concurrent vacuum collisions
Date: 2026-06-01 12:33:33
Message-ID: CAOzEurSChaPD2tMaEQ7k+=7cbgTL0D9j29o0J5-Se0SMDNWZGg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

I would like to propose a patch that adds a new GUC,
autovacuum_warning (off by default), which logs a message when an
autovacuum worker tries to process a table that is already being
vacuumed by another worker.

Motivation:

The goal is to give DBAs an early signal that autovacuum is no longer
keeping up, while there is still time to tune the configuration and
avoid the worst outcomes (severe bloat, transaction ID wraparound).
Today, by the time the existing wraparound warnings or anti-wraparound
vacuums appear, the system is already in trouble; there is no earlier
hint that autovacuum is becoming saturated.

This is modeled after checkpoint_warning, which logs when checkpoints
are happening too frequently so that DBAs know to raise max_wal_size.
In the same spirit, autovacuum_warning gives DBAs an early, actionable
signal that autovacuum is struggling, so they can react and tune the
relevant parameters promptly.

Design:

When autovacuum_warning is enabled and a worker skips a table because
another worker is already vacuuming it, the following is written to
the server log:

LOG: autovacuum: table "public.foo" is already being vacuumed by
another worker
HINT: Consider tuning the autovacuum configuration parameters.

The hint is intentionally generic: a collision has no single root
cause, and pointing at one specific parameter could be misleading.

Like checkpoint_warning, the message is emitted at LOG level and the
feature is off by default, so it adds nothing for users who don't opt
in.

The patch is attached. Thoughts?

--
Best regards,
Shinya Kato
NTT OSS Center

Attachment Content-Type Size
v1-0001-Add-autovacuum_warning-to-report-concurrent-vacuu.patch application/x-patch 4.2 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexandre Felipe 2026-06-01 13:07:47 Re: SLOPE - Planner optimizations on monotonic expressions.
Previous Message Nisha Moond 2026-06-01 12:23:08 Re: Proposal: Conflict log history table for Logical Replication