Re: another autovacuum scheduling thread - Mailing list pgsql-hackers

From Jeremy Schneider
Subject Re: another autovacuum scheduling thread
Date
Msg-id 20251008182520.6e05a8b8@ardentperf.com
Whole thread Raw
In response to Re: another autovacuum scheduling thread  (David Rowley <dgrowleyml@gmail.com>)
Responses Re: another autovacuum scheduling thread
List pgsql-hackers
On Thu, 9 Oct 2025 14:03:34 +1300
David Rowley <dgrowleyml@gmail.com> wrote:

> I thought if we're to have a priority queue that it would be hard to
> argue against sorting by how far over the given auto-vacuum threshold
> that the table is.  If you assume that a table that just meets the
> dead rows required to trigger autovacuum based on the
> autovacuum_vacuum_scale_factor setting gets a priority of 1.0, but
> another table that has n_mod_since_analyze twice over the
> autovacuum_analyze_scale_factor gets priority 2.0.  Effectively,
> prioritise by the percentage over the given threshold the table is.
> That way users could still tune things when they weren't happy with
> the priority given to a table by adjusting the corresponding
> reloption.

If users are tuning this thing then I feel like we've already lost the
battle :)

On a healthy system, autovac runs continually and hits tables at
regular intervals based on their steady state change rates. We have
existing knobs (for better or worse) that people can use to tell PG to
hit certain tables more frequently, to get rid of sleeps/delays, etc.

With our fleet of PG databases here, my current approach is geared
toward setting log_autovacuum_min_duration to some conservative value
fleet-wide, then monitoring based on the logs for any cases where it
runs longer than a defined threshold. I'm able to catch problems sooner
this way, versus monitoring on xid age alone.

Whenever there are problems with autovacuum, the actual issue is never
going to be resolved by what order autovacuum processes tables. I don't
think we should encourage any tunables here... to me it seems like
putting focus entirely in the wrong place.

-Jeremy




pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: speedup COPY TO for partitioned table.
Next
From: Peter Smith
Date:
Subject: pg_createsubscriber - more logging to say if there are no pubs to drop