Обсуждение: The consequenses of interrupted vacuum

Поиск
Список
Период
Сортировка

The consequenses of interrupted vacuum

От
Bill Moran
Дата:
Very specific question:
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?

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.

--
Bill Moran <wmoran@potentialtech.com>


Re: The consequenses of interrupted vacuum

От
Tom Lane
Дата:
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


Re: The consequenses of interrupted vacuum

От
Bill Moran
Дата:
On Thu, 27 Oct 2016 10:44:03 -0400
Tom Lane <tgl@sss.pgh.pa.us> wrote:

> > 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.

Thanks for the feedback. The good news is that grepping through recent logs,
I'm not seeing the problem any more. So I must have just noticed it on a
particularly problematic day last time I looked.

--
Bill Moran <wmoran@potentialtech.com>