mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
REINDEX CONCURRENTLY
This adds the CONCURRENTLY option to the REINDEX command. A REINDEX CONCURRENTLY on a specific index creates a new index (like CREATE INDEX CONCURRENTLY), then renames the old index away and the new index in place and adjusts the dependencies, and then drops the old index (like DROP INDEX CONCURRENTLY). The REINDEX command also has the capability to run its other variants (TABLE, DATABASE) with the CONCURRENTLY option (but not SYSTEM). The reindexdb command gets the --concurrently option. Author: Michael Paquier, Andreas Karlsson, Peter Eisentraut Reviewed-by: Andres Freund, Fujii Masao, Jim Nasby, Sergei Kornilov Discussion: https://www.postgresql.org/message-id/flat/60052986-956b-4478-45ed-8bd119e9b9cf%402ndquadrant.com#74948a1044c56c5e817a5050f554ddee
This commit is contained in:
@ -8300,42 +8300,46 @@ DropTransformStmt: DROP TRANSFORM opt_if_exists FOR Typename LANGUAGE name opt_d
|
||||
*
|
||||
* QUERY:
|
||||
*
|
||||
* REINDEX [ (options) ] type <name>
|
||||
* REINDEX [ (options) ] type [CONCURRENTLY] <name>
|
||||
*****************************************************************************/
|
||||
|
||||
ReindexStmt:
|
||||
REINDEX reindex_target_type qualified_name
|
||||
REINDEX reindex_target_type opt_concurrently qualified_name
|
||||
{
|
||||
ReindexStmt *n = makeNode(ReindexStmt);
|
||||
n->kind = $2;
|
||||
n->relation = $3;
|
||||
n->concurrent = $3;
|
||||
n->relation = $4;
|
||||
n->name = NULL;
|
||||
n->options = 0;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| REINDEX reindex_target_multitable name
|
||||
| REINDEX reindex_target_multitable opt_concurrently name
|
||||
{
|
||||
ReindexStmt *n = makeNode(ReindexStmt);
|
||||
n->kind = $2;
|
||||
n->name = $3;
|
||||
n->concurrent = $3;
|
||||
n->name = $4;
|
||||
n->relation = NULL;
|
||||
n->options = 0;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| REINDEX '(' reindex_option_list ')' reindex_target_type qualified_name
|
||||
| REINDEX '(' reindex_option_list ')' reindex_target_type opt_concurrently qualified_name
|
||||
{
|
||||
ReindexStmt *n = makeNode(ReindexStmt);
|
||||
n->kind = $5;
|
||||
n->relation = $6;
|
||||
n->concurrent = $6;
|
||||
n->relation = $7;
|
||||
n->name = NULL;
|
||||
n->options = $3;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| REINDEX '(' reindex_option_list ')' reindex_target_multitable name
|
||||
| REINDEX '(' reindex_option_list ')' reindex_target_multitable opt_concurrently name
|
||||
{
|
||||
ReindexStmt *n = makeNode(ReindexStmt);
|
||||
n->kind = $5;
|
||||
n->name = $6;
|
||||
n->concurrent = $6;
|
||||
n->name = $7;
|
||||
n->relation = NULL;
|
||||
n->options = $3;
|
||||
$$ = (Node *)n;
|
||||
|
Reference in New Issue
Block a user