Re: Autovacuum freeze scores wrap around for just-vacuumed tables

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: Baji Shaik <baji(dot)pgdev(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Autovacuum freeze scores wrap around for just-vacuumed tables
Date: 2026-11-11 21:51:18
Message-ID: avTjViWldKgvyuzu@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Nov 11, 2026 at 08:39:47AM -0800, Bharath Rupireddy wrote:
> On Wed, Nov 11, 2026 at 6:47 AM Baji Shaik <baji(dot)pgdev(at)gmail(dot)com> wrote:
>> The window grows with the number of
>> relations; with a few thousand tables, pg_stat_autovacuum_scores shows
>> it hundreds of times a minute.
>
> I remember in the past, I measured how big this window could be by
> having thousands of relations in a database and capturing the catalog
> scan time, if my memory is right, the window isn't that big. However,
> it's worth fixing it.

Yeah, in both cases the pg_class scans pretty much immediately follow
retrieving the recent (M)XID, so the window should tend to be short. Plus,
there needs to be some kind of concurrent manual vacuum or rewrite, so it's
probably quite rare in practice.

> I think this needs to be back-patched to PG19 (assuming we have
> another release after RC2 before the planned GA on Nov 19th). Although
> the issue looks rare in practice, it is good for keeping the version
> diff small.

If the only consequence is that a table might be given unduly high
priority, then I don't view this as a release blocker. I might not be able
to get this committed in time for the GA code freeze, but I do think it's
worth fixing. Baji, can you please make sure there's a commitfest entry so
it doesn't get lost? Please mark me as the committer.

--
nathan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message João Rito 2026-11-11 22:12:30 Re: Fix for consume_xids advancing XIDs incorrectly
Previous Message Tomas Vondra 2026-11-11 21:47:46 Re: reconsider_full_join_clause fails to consider if COALESCE() arguments are NULL-preserving