Re: Can manual vacuuming conflict with auto vacuuming?

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Mahesh Jhala <mjhala(at)carrentals(dot)com>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Can manual vacuuming conflict with auto vacuuming?
Date: 2017-06-01 19:16:40
Message-ID: 20170601191640.rj6zda65pd5tgjrg@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Mahesh Jhala wrote:
> Hello All,
>
> If autovacuum of a large PostgreSQL table is in progress, and I start
> a manual vacuum on the table, is there likely to be a conflict
> (locking etc.) between the two vacuums?

It depends on the autovacuum being for-wraparound or not. If not, then
the conflict will be detected within one second and autovacuum will
cancel itself, so the regular vacuum would be able to proceed. So there
is a one-second period of time during which you would see the manual
vacuum as blocked by autovacuum.

If autovacuum is for wraparound protection, then it won't cancel itself,
and the regular vacuum will just wait until autovacuum is finished.

There is a final stage in vacuuming (both auto and regular) during which
the table is truncated (the last few empty pages, if any). There's some
heuristics to handle that case nowadays which I don't remember very
clearly.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Scott Marlowe 2017-06-01 19:20:49 Re: Can manual vacuuming conflict with auto vacuuming?
Previous Message Mahesh Jhala 2017-06-01 19:11:11 Can manual vacuuming conflict with auto vacuuming?