summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/optimizer/path/costsize.c1
-rw-r--r--src/backend/optimizer/plan/createplan.c3
-rw-r--r--src/backend/pgxc/plan/planner.c5
-rw-r--r--src/backend/utils/misc/guc.c24
-rw-r--r--src/include/optimizer/cost.h1
-rw-r--r--src/include/pgxc/planner.h2
6 files changed, 33 insertions, 3 deletions
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index 45a4f39169..d3b0e279fe 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -120,6 +120,7 @@ bool enable_mergejoin = true;
bool enable_hashjoin = true;
#ifdef PGXC
bool enable_remotejoin = true;
+bool enable_remotegroup = true;
#endif
typedef struct
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
index 4d94232a7d..57420d589a 100644
--- a/src/backend/optimizer/plan/createplan.c
+++ b/src/backend/optimizer/plan/createplan.c
@@ -5840,6 +5840,9 @@ create_remotegrouping_plan(PlannerInfo *root, Plan *local_plan)
List *remote_qual;
List *local_qual;
+ /* Remote grouping is not enabled, don't do anything */
+ if (!enable_remotegroup)
+ return local_plan;
/*
* We don't push aggregation and grouping to datanodes, in case there are
* windowing aggregates, distinct, having clause or sort clauses.
diff --git a/src/backend/pgxc/plan/planner.c b/src/backend/pgxc/plan/planner.c
index 5a21bb273d..48cb0b123a 100644
--- a/src/backend/pgxc/plan/planner.c
+++ b/src/backend/pgxc/plan/planner.c
@@ -167,6 +167,8 @@ typedef struct XCWalkerContext
/* Forbid unsafe SQL statements */
bool StrictStatementChecking = true;
+/* fast query shipping is enabled by default */
+bool enable_fast_query_shipping = true;
static void get_plan_nodes(PlannerInfo *root, RemoteQuery *step, RelationAccessType accessType);
static bool get_plan_nodes_walker(Node *query_node, XCWalkerContext *context);
@@ -3207,6 +3209,9 @@ pgxc_fqs_planner(Query *query, int cursorOptions, ParamListInfo boundParams)
RemoteQuery *query_step;
StringInfoData buf;
+ /* Try by-passing standard planner, if fast query shipping is enabled */
+ if (!enable_fast_query_shipping)
+ return NULL;
/*
* If the query needs coordinator for evaluation or the query can be
* completed on coordinator itself, we plan it through standard_planner()
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 0bf5bc159c..9ec7054923 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -778,15 +778,33 @@ static struct config_bool ConfigureNamesBool[] =
NULL, NULL, NULL
},
#ifdef PGXC
- {
+ {
{"enable_remotejoin", PGC_USERSET, QUERY_TUNING_METHOD,
gettext_noop("Enables the planner's use of remote join plans."),
NULL
- },
+ },
&enable_remotejoin,
true,
NULL, NULL, NULL
- },
+ },
+ {
+ {"enable_fast_query_shipping", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables the planner's use of fast query shipping to ship query directly to datanode."),
+ NULL
+ },
+ &enable_fast_query_shipping,
+ true,
+ NULL, NULL, NULL
+ },
+ {
+ {"enable_remotegroup", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables the planner's use of remote group plans."),
+ NULL
+ },
+ &enable_remotegroup,
+ true,
+ NULL, NULL, NULL
+ },
#endif
{
{"geqo", PGC_USERSET, QUERY_TUNING_GEQO,
diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h
index b027a08e24..f5b7f6e2c7 100644
--- a/src/include/optimizer/cost.h
+++ b/src/include/optimizer/cost.h
@@ -62,6 +62,7 @@ extern bool enable_mergejoin;
extern bool enable_hashjoin;
#ifdef PGXC
extern bool enable_remotejoin;
+extern bool enable_remotegroup;
#endif
extern int constraint_exclusion;
diff --git a/src/include/pgxc/planner.h b/src/include/pgxc/planner.h
index cf1cc33dac..cebb50f7d5 100644
--- a/src/include/pgxc/planner.h
+++ b/src/include/pgxc/planner.h
@@ -130,6 +130,8 @@ typedef struct
ExecNodes *exec_nodes;
} JoinReduceInfo;
+/* global variable corresponding to the GUC with same name */
+extern bool enable_fast_query_shipping;
/* forbid SQL if unsafe, useful to turn off for development */
extern bool StrictStatementChecking;