Re: autovacuum_freeze_max_age on append-only tables

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: senor <frio_cervesa(at)hotmail(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: autovacuum_freeze_max_age on append-only tables
Date: 2022-04-20 23:18:38
Message-ID: CAH2-WzkgG92ijCw1wJ=4GN=j0mZHVVdRCYnMD=Sn7rZ1JWfbUA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Apr 20, 2022 at 4:06 PM senor <frio_cervesa(at)hotmail(dot)com> wrote:
> I'm attempting to mimic a new feature in version 13 where INSERTS will trigger vacuum for an append-only table.

The problem with that idea is that you need to express the idea that
the table needs to be vacuumed now in terms of its "age", denominated
in XIDs -- but XIDs consumed by the entire system, not just those XIDs
that happen to modify your append-only table. It will likely be very
hard for you to figure out a way to relate these logical units (XIDs)
to some kind of physical cost that captures how far behind you are on
freezing (like blocks, or even tuples). Maybe you'll find something
that works through trial and error, but I wouldn't count on it.

> I'm apparently needing an education on how this "to avoid wraparound" vacuum differs from any other. I've seen it referenced as "more aggressive" but I'd like details. An upgrade to 13 is "right around the corner".

It's complicated -- more complicated than it really should be.
Technically an anti-wraparound autovacuum and an aggressive vacuum are
two different things. In practice anti-wraparound autovacuums are
virtually guaranteed to be aggressive, though an aggressive autovacuum
may not be an antiwraparound VACUUM (sometimes we do aggressive
vacuuming because autovacuum launched a worker before
age(relfrozenxid) reached autovacuum_freeze_max_age, but after
age(relfrozenxid) reached vacuum_freeze_table_age).

See my recent response to a similar question here:

https://postgr.es/m/CAH2-WzkFQ-okvVXizpy4dCEVq75N-Qykh=crhZaO-eaJfLVOPQ@mail.gmail.com

--
Peter Geoghegan

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2022-04-21 01:07:09 Re: alter function/procedure depends on extension
Previous Message senor 2022-04-20 23:06:25 autovacuum_freeze_max_age on append-only tables