mirror of
https://github.com/postgres/postgres.git
synced 2025-12-21 05:21:08 +03:00
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
This commit is contained in:
@@ -10538,6 +10538,8 @@ vacuum_option_elem:
|
||||
{
|
||||
if (strcmp($1, "disable_page_skipping") == 0)
|
||||
$$ = VACOPT_DISABLE_PAGE_SKIPPING;
|
||||
else if (strcmp($1, "skip_locked") == 0)
|
||||
$$ = VACOPT_SKIP_LOCKED;
|
||||
else
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
@@ -10571,6 +10573,16 @@ analyze_option_list:
|
||||
|
||||
analyze_option_elem:
|
||||
VERBOSE { $$ = VACOPT_VERBOSE; }
|
||||
| IDENT
|
||||
{
|
||||
if (strcmp($1, "skip_locked") == 0)
|
||||
$$ = VACOPT_SKIP_LOCKED;
|
||||
else
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("unrecognized ANALYZE option \"%s\"", $1),
|
||||
parser_errposition(@1)));
|
||||
}
|
||||
;
|
||||
|
||||
analyze_keyword:
|
||||
|
||||
Reference in New Issue
Block a user