diff options
author | Tomas Vondra | 2017-06-10 17:40:50 +0000 |
---|---|---|
committer | Tomas Vondra | 2017-06-10 17:40:50 +0000 |
commit | 90d1109aa3397c6beb50b12cd8e5364861037424 (patch) | |
tree | a9a99593a526c75d7cb53b921a75dfe2be23f57b /src/backend/optimizer | |
parent | 873c6a55b0374fd8ad4095970fe6f488418339d8 (diff) |
Restrict subplan nodes even for equal distributions
Many regression tests were failing because the expected plan contains
Remote Subquery Scan on all (datanode_1)
but we were producing
Remote Subquery Scan on any (datanode_1,datanode_2)
Both those plans are in fact valid (at least on replicated tables).
The difference is that in the first case the restriction was computed
in adjust_subplan_distribution() while in the second case this did not
happen (and instead will happen at execution time).
The restriction is not applied because adjust_subplan_distribution()
contains this condition
if (subd && !equal(subd, pathd))
{
... restrict execution nodes ...
}
In Postgres-XL 9.6 the two distributions happen to be equal in some
cases where where that was not the case in Postgres-XL 9.5. It's not
entirely clear why this happens (it seems to be another consequence
of the upper-planner pathification), but the consequence is that the
restriction code is skipped.
Removing the equal() call from the condition fixes all the regression
failures caused by plans switching between any/all restrictions. In
fact, this fixes all remaining regressions failures in five regression
suites: create_view, subselect, aggregates, rangefuncs, xc_having.
In the future, we will probably pathify adjust_subplan_distribution(),
i.e. we'll probably get rid of it entirely and compute the restriction
either when constructing the path or possibly defer it until execution
time. Before the upper-planner pathification this was not possible.
Diffstat (limited to 'src/backend/optimizer')
-rw-r--r-- | src/backend/optimizer/plan/createplan.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c index 637926ff3a..2a0aac6cba 100644 --- a/src/backend/optimizer/plan/createplan.c +++ b/src/backend/optimizer/plan/createplan.c @@ -2355,13 +2355,9 @@ adjust_subplan_distribution(PlannerInfo *root, Distribution *pathd, root->curOuterRestrict = NULL; /* - * Set new restriction for the subpath - * Do not restrict if distributions are equal, they are going to be merged - * and subplan will be executed on caller nodes. - * However if there are upper query levels caller's distribution may be - * adjusted. + * Set new restriction for the subpath. */ - if (subd && !equal(subd, pathd)) + if (subd) { /* * If subpath is replicated without restriction choose one execution |