agora inbox for pgsql-admin@postgresql.org  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Ron Johnson <ronljohnsonjr@gmail.com>
To: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: VACUUM FREEZE vs plain VACUUM
Date: Fri, 18 Jul 2025 06:31:18 +0200
Message-ID: <e557474d5ee29cca18cea4efb5c3980daaf43cff.camel@cybertec.at> (raw)
In-Reply-To: <CANzqJaABg-S=qYnn7P2BzVzLYc2Z3WzE27Kw3=erT2KyC+F-LA@mail.gmail.com>
References: <CANzqJaABg-S=qYnn7P2BzVzLYc2Z3WzE27Kw3=erT2KyC+F-LA@mail.gmail.com>

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





view thread (9+ messages)  latest in thread

Message-ID: <e557474d5ee29cca18cea4efb5c3980daaf43cff.camel@cybertec.at>
Permalink:  ../e557474d5ee29cca18cea4efb5c3980daaf43cff.camel@cybertec.at/
Also on:    postgresql.org/message-id/e557474d5ee29cca18cea4efb5c3980daaf43cff.camel@cybertec.at

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: laurenz.albe@cybertec.at, ronljohnsonjr@gmail.com
  Subject: Re: VACUUM FREEZE vs plain VACUUM
  In-Reply-To: <e557474d5ee29cca18cea4efb5c3980daaf43cff.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox