Обсуждение: pgsql: Add option SKIP_LOCKED to VACUUM and ANALYZE

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

pgsql: Add option SKIP_LOCKED to VACUUM and ANALYZE

От
Michael Paquier
Дата:
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(-)