From: Tom Lane <tgl@sss.pgh.pa.us>
To: rihad <rihad@mail.ru>
Cc: pgsql-general General <pgsql-general@postgresql.org>
Subject: Re: When do vacuumed pages/tuples become available for reuse?
Date: Thu, 11 Apr 2019 09:48:06 -0400
Message-ID: <8560.1554990486@sss.pgh.pa.us> (raw)
In-Reply-To: <9cd73fcb-511d-ede9-6789-209b7d4eb193@mail.ru>
References: <9cd73fcb-511d-ede9-6789-209b7d4eb193@mail.ru>
rihad <rihad@mail.ru> writes:
> If an autovacuum job on a huge table runs for 5-6 hours, do its freed
> pages/tuples become available for reuse immediately when they are marked
> as free, or only at the end of the multi-hour vacuum operation?
They'll be freed in batches, where the size of a batch depends on the
autovacuum_work_mem or maintenance_work_mem setting. The basic
work cycle is
* scan table to find dead tuples, save their TIDs in working memory;
continue until end of table or working memory full
* scan indexes to find index entries matching those TIDs, remove 'em
* go back to table and remove the previously-found tuples
* if not end of table, repeat
So a larger work-mem setting means fewer passes over the indexes,
but a longer time until space is reclaimed.
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, rihad@mail.ru
Subject: Re: When do vacuumed pages/tuples become available for reuse?
In-Reply-To: <8560.1554990486@sss.pgh.pa.us>
References: <9cd73fcb-511d-ede9-6789-209b7d4eb193@mail.ru> <8560.1554990486@sss.pgh.pa.us>
* 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