Re: autovacuum prioritization - Mailing list pgsql-hackers

From Robert Haas
Subject Re: autovacuum prioritization
Date
Msg-id CA+TgmoYfRgmHgAyqSbLg09x9gwKmRzWYUZFefubPXY1agNuv7Q@mail.gmail.com
Whole thread Raw
In response to Re: autovacuum prioritization  (Greg Stark <stark@mit.edu>)
List pgsql-hackers
On Wed, Jan 26, 2022 at 6:46 PM Greg Stark <stark@mit.edu> wrote:
> One thing I've been wanting to do something about is I think
> autovacuum needs to be a little cleverer about when *not* to vacuum a
> table because it won't do any good.

I agree.

> I was thinking of just putting a check in before kicking off a vacuum
> and if the globalxmin is a significant fraction of the distance to the
> relfrozenxid then instead log a warning. Basically it means "we can't
> keep the bloat below the threshold due to the idle transactions et al,
> not because there's insufficient i/o bandwidth".

Unfortunately, XID distances don't tell us much, because the tuples
need not be uniformly distributed across the XID space. In fact, it
seems highly likely that they will be very non-uniformly distributed,
with a few transactions having created a lot of dead tuples and most
having created none. Therefore, it's pretty plausible that a vacuum
that permits relfrozenxid++ could solve every problem we have. If we
knew something about the distribution of dead XIDs in the table, then
we could make an intelligent judgement about whether vacuuming would
be useful. But otherwise I feel like we're just guessing, so instead
of really fixing the problem we'll just be making it happen in a set
of cases that's even harder to grasp.

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



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Ensure that STDERR is empty during connect_ok
Next
From: Robert Haas
Date:
Subject: Re: CREATEROLE and role ownership hierarchies