You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by rl...@apache.org on 2016/10/28 03:53:12 UTC

[09/17] incubator-hawq git commit: HAWQ-1122. Add ORCA optimizer GUC optimizer_parallel_union for parallel append (#977)

HAWQ-1122. Add ORCA optimizer GUC optimizer_parallel_union for parallel append (#977)

This GUC is disabled by default.

Currently, when users run an `UNION ALL` query, such as
```sql
SELECT a FROM foo UNION ALL SELECT b FROM bar
```,
GPDB will parallelize the execution across all the segments, but the
table scans on `foo` and `bar` are not executed parallel. With this GUC
enabled, we add redistribution motion node under APPEND(UNION) operator,
which makes all the children of APPEND(UNION) operator execute in
parallel in every segment.

This is cherry-picked from greenplum-db/gpdb@86e49e51d39ed0d252cbf6a79c2fc62e36a4e307


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/e7bba170
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/e7bba170
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/e7bba170

Branch: refs/heads/master
Commit: e7bba17080139dd1f20d9d875947b62a2d543082
Parents: f0d891f
Author: Haisheng Yuan <hy...@pivotal.io>
Authored: Wed Jul 27 19:03:32 2016 -0500
Committer: rlei <rl...@pivotal.io>
Committed: Fri Oct 28 11:52:20 2016 +0800

----------------------------------------------------------------------
 src/backend/gpopt/config/CConfigParamMapping.cpp |  7 +++++++
 src/backend/utils/misc/guc.c                     | 11 +++++++++++
 src/include/utils/guc.h                          |  1 +
 3 files changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/e7bba170/src/backend/gpopt/config/CConfigParamMapping.cpp
----------------------------------------------------------------------
diff --git a/src/backend/gpopt/config/CConfigParamMapping.cpp b/src/backend/gpopt/config/CConfigParamMapping.cpp
index b7b0475..4a2073c 100644
--- a/src/backend/gpopt/config/CConfigParamMapping.cpp
+++ b/src/backend/gpopt/config/CConfigParamMapping.cpp
@@ -384,6 +384,13 @@ CConfigParamMapping::SConfigMappingElem CConfigParamMapping::m_elem[] =
 		&optimizer_prefer_scalar_dqa_multistage_agg,
 		false, // m_fNegate
 		GPOS_WSZ_LIT("Prefer multistage aggregates for scalar distinct qualified aggregate in the optimizer.")
+		},
+
+		{
+		EopttraceEnableParallelAppend,
+		&optimizer_parallel_union,
+		false, // m_fNegate
+		GPOS_WSZ_LIT("Enable parallel execution for UNION/UNION ALL queries.")
 		}
 };
 

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/e7bba170/src/backend/utils/misc/guc.c
----------------------------------------------------------------------
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 2cdcb62..a936765 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -764,6 +764,7 @@ bool 		optimizer_multilevel_partitioning;
 bool        optimizer_enable_derive_stats_all_groups;
 bool		optimizer_explain_show_status;
 bool		optimizer_prefer_scalar_dqa_multistage_agg;
+bool 		optimizer_parallel_union;
 
 /* Security */
 bool		gp_reject_internal_tcp_conn = true;
@@ -4387,6 +4388,16 @@ static struct config_bool ConfigureNamesBool[] =
 		true, NULL, NULL
 	},
 
+	{
+		{"optimizer_parallel_union", PGC_USERSET, DEVELOPER_OPTIONS,
+			gettext_noop("Enable parallel execution for UNION/UNION ALL queries."),
+			NULL,
+			GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
+		},
+		&optimizer_parallel_union,
+		false, NULL, NULL
+	},
+
 	/* End-of-list marker */
 	{
 		{NULL, 0, 0, NULL, NULL}, NULL, false, NULL, NULL

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/e7bba170/src/include/utils/guc.h
----------------------------------------------------------------------
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h
index 41f7056..58b2b61 100644
--- a/src/include/utils/guc.h
+++ b/src/include/utils/guc.h
@@ -440,6 +440,7 @@ extern bool optimizer_multilevel_partitioning;
 extern bool optimizer_enable_derive_stats_all_groups;
 extern bool optimizer_explain_show_status;
 extern bool optimizer_prefer_scalar_dqa_multistage_agg;
+extern bool optimizer_parallel_union;
 
 /**
  * Enable logging of DPE match in optimizer.