Re: The consequenses of interrupted vacuum

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: The consequenses of interrupted vacuum
Дата
Msg-id 18943.1477579443@sss.pgh.pa.us
обсуждение исходный текст
Ответ на The consequenses of interrupted vacuum  (Bill Moran <wmoran@potentialtech.com>)
Ответы Re: The consequenses of interrupted vacuum  (Bill Moran <wmoran@potentialtech.com>)
Список pgsql-general
Bill Moran <wmoran@potentialtech.com> writes:
> Does interrupting a VACUUM (not FULL) rollback all the work it has done
> so far, or is the work done on a page by page basis such that at least
> some of the pages in the table have been vacuumed?

Depends on how big the table is, how many dead tuples there are, and
what maintenance_work_mem is set to.

The basic cycle is: scan heap pages until we have maintenance_work_mem
worth of TIDs of dead tuples (at 6 bytes apiece, this is generally a lot
of TIDs).  Then scan indexes and remove index entries matching those TIDs.
Then rescan heap pages and remove the dead tuples themselves.  Repeat,
starting at wherever we left off the outer scan, until whole table has
been cleaned.

If you interrupt this, the work done by any fully-completed cycles is not
going to need to be done over.  (We may have to rescan heap pages to
re-verify that there's no dead tuples there, but that's relatively cheap
compared to the index cleaning and tuple deletion phases.)  But the
cycle-in-progress is mostly going to have to be repeated.

Also, only completion of a vacuum is going to convince autovacuum that
it doesn't need to do anything with the table.

> I'm asking for cases of large tables where autovacuum frequently gets
> interrupted. I'm trying to understand if the partial runs are at least
> making _some_ progress so the next vacuum has less to do, or if this is
> a serious problem that I need to fiddle with tuning to fix.

It's probably making some progress but not much.  You need to fix that.

            regards, tom lane


В списке pgsql-general по дате отправления:

Предыдущее
От: Marcin Giedz
Дата:
Сообщение: libpq heartbeat
Следующее
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: libpq heartbeat