aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/path/allpaths.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/optimizer/path/allpaths.c')
-rw-r--r--src/backend/optimizer/path/allpaths.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c
index 63f0f6b79c7..b23cc8ee82d 100644
--- a/src/backend/optimizer/path/allpaths.c
+++ b/src/backend/optimizer/path/allpaths.c
@@ -554,12 +554,11 @@ set_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
* its own pool of workers. Instead, we'll consider gathering partial
* paths for the parent appendrel.
*
- * Also, if this is the topmost scan/join rel (that is, the only baserel),
- * we postpone gathering until the final scan/join targetlist is available
- * (see grouping_planner).
+ * Also, if this is the topmost scan/join rel, we postpone gathering until
+ * the final scan/join targetlist is available (see grouping_planner).
*/
if (rel->reloptkind == RELOPT_BASEREL &&
- bms_membership(root->all_baserels) != BMS_SINGLETON)
+ !bms_equal(rel->relids, root->all_baserels))
generate_useful_gather_paths(root, rel, false);
/* Now find the cheapest of the paths for this rel */
@@ -3435,7 +3434,7 @@ standard_join_search(PlannerInfo *root, int levels_needed, List *initial_rels)
* partial paths. We'll do the same for the topmost scan/join rel
* once we know the final targetlist (see grouping_planner).
*/
- if (lev < levels_needed)
+ if (!bms_equal(rel->relids, root->all_baserels))
generate_useful_gather_paths(root, rel, false);
/* Find and save the cheapest paths for this rel */