Re: Vacuum very big table - how the full vacuum works in background/internally? - Mailing list pgsql-general

From Luca Ferrari
Subject Re: Vacuum very big table - how the full vacuum works in background/internally?
Date
Msg-id CAKoxK+4wQD+nYBrfseADm4pGKAShcOCODhe_2UgYHQg1AaohHQ@mail.gmail.com
Whole thread Raw
In response to Vacuum very big table - how the full vacuum works in background/internally?  (Durumdara <durumdara@gmail.com>)
Responses Re: Vacuum very big table - how the full vacuum works in background/internally?  (Durumdara <durumdara@gmail.com>)
List pgsql-general
On Thu, Oct 17, 2019 at 5:10 PM Durumdara <durumdara@gmail.com> wrote:
> Please help me, how the PGSQL full vacuum works internally? (1., 2. case, or something else)
>

As far as I know a VACUUM FULL will rewrite the whole table without
inserting (and therefore deleting later) not visible tuples. I would
be quite surprised of it duplicating the table and removing after the
tuples.
Surely it is a very invasive command that locks the table and requires I/O.

> How we (and the clients) prepare to this operation?
> We must know it to avoid disk out problems, and too much off-time.

The best guess is that you are going to need almost the double of the
table size. Since you said that autovacuum is preventing the table to
grow, it could mean all the reclaimed space has been consumed by other
tuples, so I'm not sure vacuum full can provide you space.
Have you looked at pg_stat_user_tables to see the dead tuples fraction?

Luca



pgsql-general by date:

Previous
From: Durumdara
Date:
Subject: Vacuum very big table - how the full vacuum works in background/internally?
Next
From: Reid Thompson
Date:
Subject: Re: Can you please tell us how set this prefetch attribute infollowing lines.