pgsql: Add option SKIP_LOCKED to VACUUM and ANALYZE

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add option SKIP_LOCKED to VACUUM and ANALYZE
Date: 2018-10-04 00:08:15
Message-ID: E1g7rBf-0005NL-OF@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add option SKIP_LOCKED to VACUUM and ANALYZE

When specified, this option allows VACUUM to skip the work on a relation
if there is a conflicting lock on it when trying to open it at the
beginning of its processing.

Similarly to autovacuum, this comes with a couple of limitations while
the relation is processed which can cause the process to still block:
- when opening the relation indexes.
- when acquiring row samples for table inheritance trees, partition trees
or certain types of foreign tables, and that a lock is taken on some
leaves of such trees.

Author: Nathan Bossart
Reviewed-by: Michael Paquier, Andres Freund, Masahiko Sawada
Discussion: https://postgr.es/m/9EF7EBE4-720D-4CF1-9D0E-4403D7E92990@amazon.com
Discussion: https://postgr.es/m/20171201160907.27110.74730@wrigleys.postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/803b1301e8c9aac478abeec62824a5d09664ffff

Modified Files
--------------
doc/src/sgml/ref/analyze.sgml | 19 +++
doc/src/sgml/ref/vacuum.sgml | 21 +++
src/backend/commands/vacuum.c | 26 +++-
src/backend/parser/gram.y | 12 ++
src/include/nodes/parsenodes.h | 3 +-
src/test/isolation/expected/vacuum-skip-locked.out | 171 +++++++++++++++++++++
src/test/isolation/isolation_schedule | 1 +
src/test/isolation/specs/vacuum-skip-locked.spec | 59 +++++++
src/test/regress/expected/vacuum.out | 16 +-
src/test/regress/sql/vacuum.sql | 12 +-
10 files changed, 333 insertions(+), 7 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2018-10-04 09:29:54 pgsql: Refactor user-facing SQL functions signalling backends
Previous Message Andres Freund 2018-10-03 20:34:17 pgsql: Replace uint64 use introduced in 4868e446859 in light of 595a0ea