pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Arnav <justdba03@gmail.com>
To: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: VACUUM freeze
Date: Mon, 20 Apr 2020 10:55:56 +0200
Message-ID: <8042edc6f769a8577ee36b1167e355f254141d97.camel@cybertec.at> (raw)
In-Reply-To: <CAF0ZvMxPdYVwDck0MemYNe2GFcmQpGH3cp4x05sBopieSdeEeQ@mail.gmail.com>
References: <CAF0ZvMxPdYVwDck0MemYNe2GFcmQpGH3cp4x05sBopieSdeEeQ@mail.gmail.com>

On Sat, 2020-04-18 at 23:55 +0530, Arnav wrote:
> what is VACUUM freeze , does it not allow autovacuum to happen ever.
> if yes till how long?

VACUUM (FREEZE) marks all rows that are visible to everybody as
unconditionally visible.
All rows that live long have to get frozen at some point, so that they
can survive transaction wraparound without data corruption, because the
internal transaction ID that created them is stored in the row metadata.

This can be useful for insert-only tables, since autovacuum won't have
to touch frozen rows ever again unless they get updated or deleted.

The negative aspect of freezing all rows is that all rows that are frozen
get modified, which means that the block containing them becomes dirty
and has to be written to disk again.  Now if any such row is modified or
deleted later, freezing the row has generated unnecessary I/O.

This is why by default VACUUM will freeze only rows whose creating
transaction is more then 50 million transactions in the past, in the
hope that such rows have less chance to be modified again than more
recent rows.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com






view thread (7+ messages)

Message-ID: <8042edc6f769a8577ee36b1167e355f254141d97.camel@cybertec.at>
Permalink:  ../8042edc6f769a8577ee36b1167e355f254141d97.camel@cybertec.at/
Also on:    postgresql.org/message-id/8042edc6f769a8577ee36b1167e355f254141d97.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, justdba03@gmail.com
  Subject: Re: VACUUM freeze
  In-Reply-To: <8042edc6f769a8577ee36b1167e355f254141d97.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 DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox