summaryrefslogtreecommitdiff
path: root/src/backend/parser
diff options
context:
space:
mode:
authorPavan Deolasee2017-04-06 05:34:14 +0000
committerPavan Deolasee2017-05-05 04:59:34 +0000
commit671d817915fee9f49ca7993ca035e116cd700568 (patch)
tree47d32fdd6a69ae10e387e105793cbcb3b8d53d36 /src/backend/parser
parent275ef1024983bd39dc07a6d73944ef7a8b9a9594 (diff)
Support an additional syntax ANALYZE (COORDINATOR) to allow users to rebuild
coordinator side statistics without running ANALYZE again on the datanodes. When ANALYZE (COORDINATOR) is run, we don't update planner statistics on the datanodes. But simply gather the existing statistics and update coordinator side view of the global stats. The command only updates statistics on the current coordinator and to update stats on all coordintors, the command must be executed on all coordintors separately.
Diffstat (limited to 'src/backend/parser')
-rw-r--r--src/backend/parser/gram.y28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 00744a4980..54af976917 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -308,6 +308,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
%type <ival> opt_lock lock_type cast_context
%type <ival> vacuum_option_list vacuum_option_elem
+%type <ival> analyze_option_list analyze_option_elem
%type <boolean> opt_force opt_or_replace
opt_grant_grant_option opt_grant_admin_option
opt_nowait opt_if_exists opt_with_data
@@ -9766,6 +9767,22 @@ AnalyzeStmt:
n->va_cols = $4;
$$ = (Node *)n;
}
+ | analyze_keyword '(' analyze_option_list ')'
+ {
+ VacuumStmt *n = makeNode(VacuumStmt);
+ n->options = VACOPT_ANALYZE | $3;
+ n->relation = NULL;
+ n->va_cols = NIL;
+ $$ = (Node *)n;
+ }
+ | analyze_keyword '(' analyze_option_list ')' qualified_name opt_name_list
+ {
+ VacuumStmt *n = makeNode(VacuumStmt);
+ n->options = VACOPT_ANALYZE | $3;
+ n->relation = $5;
+ n->va_cols = $6;
+ $$ = (Node *)n;
+ }
;
analyze_keyword:
@@ -9786,6 +9803,17 @@ opt_freeze: FREEZE { $$ = TRUE; }
| /*EMPTY*/ { $$ = FALSE; }
;
+
+analyze_option_list:
+ analyze_option_elem { $$ = $1; }
+ | analyze_option_list ',' analyze_option_elem { $$ = $1 | $3; }
+ ;
+
+analyze_option_elem:
+ VERBOSE { $$ = VACOPT_VERBOSE; }
+ | COORDINATOR { $$ = VACOPT_COORDINATOR; }
+ ;
+
opt_name_list:
'(' name_list ')' { $$ = $2; }
| /*EMPTY*/ { $$ = NIL; }