pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Mahesh Jhala <mjhala@carrentals.com>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: Can manual vacuuming conflict with auto vacuuming?
Date: Thu, 1 Jun 2017 15:16:40 -0400
Message-ID: <20170601191640.rj6zda65pd5tgjrg@alvherre.pgsql> (raw)
In-Reply-To: <CY1PR02MB210591B98EF1786C92B91CB1B5F60@CY1PR02MB2105.namprd02.prod.outlook.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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


-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



view thread (4+ messages)  latest in thread

Message-ID: <20170601191640.rj6zda65pd5tgjrg@alvherre.pgsql>
Permalink:  ../20170601191640.rj6zda65pd5tgjrg@alvherre.pgsql/
Also on:    postgresql.org/message-id/20170601191640.rj6zda65pd5tgjrg@alvherre.pgsql

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: alvherre@2ndquadrant.com, mjhala@carrentals.com
  Subject: Re: Can manual vacuuming conflict with auto vacuuming?
  In-Reply-To: <20170601191640.rj6zda65pd5tgjrg@alvherre.pgsql>

* 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