Re: New criteria for autovacuum - Mailing list pgsql-hackers

From Robert Haas
Subject Re: New criteria for autovacuum
Date
Msg-id CA+TgmoZqA1dPn-0=AtX9PJpOJRXncXUu7khbFRri3vJPTb+oRw@mail.gmail.com
Whole thread Raw
In response to Re: New criteria for autovacuum  (Melanie Plageman <melanieplageman@gmail.com>)
List pgsql-hackers
On Fri, Apr 4, 2025 at 12:11 PM Melanie Plageman
<melanieplageman@gmail.com> wrote:
> That being said, long-running transactions are a problem for
> autovacuum in general. Even if you track this stat you are proposing
> about heap fetches by index only scans, you won't know if the long
> running transaction is over and thus if it makes sense to try and
> trigger an autovacuum for that table again anyway.

This. It would be really useful to have some kind of a system for
figuring out when -- in terms of XIDs -- we ought to vacuum which
table. I think that's a hard problem, but it would help a lot of
people.

I do not think the approach in the proposed patch is correct at all.
The proposed new check would have exactly the same problem as the
existing one -- this could easily trigger vacuuming at a time when the
relevant tuples can't yet be made all-visible, in which case we'd just
do a lot of VACUUM work for nothing. That's already a problem with
autovacuum in some scenarios, and I bet this would be way worse.

--
Robert Haas
EDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Exponential notation bug
Next
From: Alena Rybakina
Date:
Subject: Re: Replace IN VALUES with ANY in WHERE clauses during optimization