summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavan Deolasee2015-08-19 03:08:27 +0000
committerPavan Deolasee2015-08-19 03:08:27 +0000
commit2b6985afdb754282349f768e6cdf256178d04f4d (patch)
tree81ba438b428a9483431e17a7c7c540d99a99a93e
parent772dc2c41014a6c5e76e283b1cabd9e00b547680 (diff)
Revert changes made to join pushdown for materialised views.
Its not clear at the moment, but some of them might be hurting DBT3 query performance
-rw-r--r--src/backend/optimizer/util/pathnode.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c
index 81ae3d26da..1ceca4160b 100644
--- a/src/backend/optimizer/util/pathnode.c
+++ b/src/backend/optimizer/util/pathnode.c
@@ -1027,13 +1027,18 @@ set_joinpath_distribution(PlannerInfo *root, JoinPath *pathnode)
* Catalog tables are the same on all nodes, so treat them as replicated
* on all nodes.
*/
- if ((innerd && IsLocatorReplicated(innerd->distributionType)) &&
- (outerd && IsLocatorReplicated(outerd->distributionType)))
+ if ((!innerd || IsLocatorReplicated(innerd->distributionType)) &&
+ (!outerd || IsLocatorReplicated(outerd->distributionType)))
{
/* Determine common nodes */
Bitmapset *common;
- common = bms_intersect(innerd->nodes, outerd->nodes);
+ if (innerd == NULL)
+ common = bms_copy(outerd->nodes);
+ else if (outerd == NULL)
+ common = bms_copy(innerd->nodes);
+ else
+ common = bms_intersect(innerd->nodes, outerd->nodes);
if (bms_is_empty(common))
goto not_allowed_join;
@@ -1057,14 +1062,14 @@ set_joinpath_distribution(PlannerInfo *root, JoinPath *pathnode)
* nullable data nodes will produce joined rows with NULLs for cases when
* matching row exists, but on other data node.
*/
- if ((innerd && IsLocatorReplicated(innerd->distributionType)) &&
+ if ((!innerd || IsLocatorReplicated(innerd->distributionType)) &&
(pathnode->jointype == JOIN_INNER ||
pathnode->jointype == JOIN_LEFT ||
pathnode->jointype == JOIN_SEMI ||
pathnode->jointype == JOIN_ANTI))
{
/* We need inner relation is defined on all nodes where outer is */
- if (!outerd || !bms_is_subset(outerd->nodes, innerd->nodes))
+ if (innerd && !bms_is_subset(outerd->nodes, innerd->nodes))
goto not_allowed_join;
targetd = makeNode(Distribution);
@@ -1085,12 +1090,12 @@ set_joinpath_distribution(PlannerInfo *root, JoinPath *pathnode)
* nullable data nodes will produce joined rows with NULLs for cases when
* matching row exists, but on other data node.
*/
- if ((outerd && IsLocatorReplicated(outerd->distributionType)) &&
+ if ((!outerd || IsLocatorReplicated(outerd->distributionType)) &&
(pathnode->jointype == JOIN_INNER ||
pathnode->jointype == JOIN_RIGHT))
{
/* We need outer relation is defined on all nodes where inner is */
- if (!innerd || !bms_is_subset(innerd->nodes, outerd->nodes))
+ if (outerd && !bms_is_subset(innerd->nodes, outerd->nodes))
goto not_allowed_join;
targetd = makeNode(Distribution);
@@ -1274,7 +1279,6 @@ not_allowed_join:
* by has as main variant.
*/
-#ifdef NOT_USED
/* These join types allow replicated inner */
if (outerd &&
(pathnode->jointype == JOIN_INNER ||
@@ -1328,7 +1332,6 @@ not_allowed_join:
altpath->path.distribution = targetd;
alternate = lappend(alternate, altpath);
}
-#endif
/*
* Redistribute subplans to make them compatible.
@@ -2800,7 +2803,6 @@ create_nestloop_path(PlannerInfo *root,
pathnode->outerjoinpath = outer_path;
pathnode->innerjoinpath = inner_path;
pathnode->joinrestrictinfo = restrict_clauses;
-
#ifdef XCP
pathnode->movedrestrictinfo = mclauses;