Re: VACUUM FREEZE vs plain VACUUM - Mailing list pgsql-admin

From Laurenz Albe
Subject Re: VACUUM FREEZE vs plain VACUUM
Date
Msg-id e557474d5ee29cca18cea4efb5c3980daaf43cff.camel@cybertec.at
Whole thread Raw
In response to VACUUM FREEZE vs plain VACUUM  (Ron Johnson <ronljohnsonjr@gmail.com>)
Responses Re: VACUUM FREEZE vs plain VACUUM
List pgsql-admin
On Thu, 2025-07-17 at 18:03 -0400, Ron Johnson wrote:
> Does VACUUM FREEZE do something extra or special than to defer autovacuum
> for an extra 50,000,000 transactions?

What it does is set vacuum_freeze_table_age, vacuum_freeze_min_age,
vacuum_multixact_freeze_table_age and vacuum_multixact_freeze_min_age to 0:

    if (params.options & VACOPT_FREEZE)
    {
        params.freeze_min_age = 0;
        params.freeze_table_age = 0;
        params.multixact_freeze_min_age = 0;
        params.multixact_freeze_table_age = 0;
    }

So it's going to be an aggressive VACUUM.  To quote the documentation:

  An aggressive scan differs from a regular VACUUM in that it visits every
  page that might contain unfrozen XIDs or MXIDs, not just those that might
  contain dead tuples.

And it is going to freeze all tuples that are visible to everybody.

The latter will advance "relfrozenxid" and "relminmxid" for the table,
unless there is an open transaction or something similar that prevents
freezing of a tuple.

To answer your question: the extra thing it does is that it even visits
table pages that have the all-visible flag set, that is, they contain no
dead tuples.  That means that it will do more work and use more
of your system's resources.

Yours,
Laurenz Albe



pgsql-admin by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: VACUUM FREEZE vs plain VACUUM
Next
From: Laurenz Albe
Date:
Subject: Re: VACUUM FREEZE vs plain VACUUM