diff options
author | Tomas Vondra | 2017-09-15 00:13:37 +0000 |
---|---|---|
committer | Tomas Vondra | 2017-09-15 00:13:37 +0000 |
commit | 33738826264aaadf2d0b94f8ca89f3ef32301500 (patch) | |
tree | fe6d8df701b2e7db1f18a880ad48ea9f7c54b60e | |
parent | f7d1d581c950191a465b8483173f2ad69ae8fffe (diff) |
Fix incorrect planning of grouping sets
Commit 04f96689945462a4212047f03eb3281fb56bcf2f incorrectly allowed
distributed grouping paths for grouping sets, causing failures in
'groupingsets' regression test suite. So fix that by making sure
try_distributed_aggregation=false for plans with grouping sets.
-rw-r--r-- | src/backend/optimizer/plan/planner.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c index cc4b06a292..c216680889 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -3930,8 +3930,14 @@ create_grouping_paths(PlannerInfo *root, /* * The distributed aggregation however works even if there are no partial - * paths, and for grouping sets (we need to be able to at least push them - * on top of remote subplan). + * paths (when the distribution key is included in the grouping keys, we + * may simply push down the whole aggregate). + * + * XXX We currently don't even try to push down grouping sets, although we + * might do that when all grouping sets include the distribution key. But + * that seems like a fairly rare case, as in most cases there will be + * empty grouping set () aggregating all the data. So let's look into this + * optimization later. */ if (!grouped_rel->consider_parallel) { @@ -3946,6 +3952,11 @@ create_grouping_paths(PlannerInfo *root, */ try_distributed_aggregation = false; } + else if (parse->groupingSets) + { + /* We don't know how to do grouping sets in parallel. */ + try_distributed_aggregation = false; + } else if (agg_costs->hasNonPartial || agg_costs->hasNonSerial) { /* Insufficient support for partial mode. */ |