* rel once we know the final targetlist (see
* grouping_planner).
*/
- if (old_clump->size + new_clump->size < num_gene)
+ if (!bms_equal(joinrel->relids, root->all_baserels))
generate_useful_gather_paths(root, joinrel, false);
/* Find and save the cheapest paths for this joinrel */
* 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 */
* 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 */