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.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c
index d9a2f9bf695..2aa8837880c 100644
--- a/src/backend/optimizer/path/allpaths.c
+++ b/src/backend/optimizer/path/allpaths.c
@@ -479,23 +479,28 @@ set_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
}
/*
- * If this is a baserel, consider gathering any partial paths we may have
- * created for it. (If we tried to gather inheritance children, we could
- * end up with a very large number of gather nodes, each trying to grab
- * its own pool of workers, so don't do this for otherrels. Instead,
- * we'll consider gathering partial paths for the parent appendrel.)
- */
- if (rel->reloptkind == RELOPT_BASEREL)
- generate_gather_paths(root, rel);
-
- /*
* Allow a plugin to editorialize on the set of Paths for this base
* relation. It could add new paths (such as CustomPaths) by calling
- * add_path(), or delete or modify paths added by the core code.
+ * add_path(), or add_partial_path() if parallel aware. It could also
+ * delete or modify paths added by the core code.
*/
if (set_rel_pathlist_hook)
(*set_rel_pathlist_hook) (root, rel, rti, rte);
+ /*
+ * If this is a baserel, we should normally consider gathering any partial
+ * paths we may have created for it. We have to do this after calling the
+ * set_rel_pathlist_hook, else it cannot add partial paths to be included
+ * here.
+ *
+ * However, if this is an inheritance child, skip it. Otherwise, we could
+ * end up with a very large number of gather nodes, each trying to grab
+ * its own pool of workers. Instead, we'll consider gathering partial
+ * paths for the parent appendrel.
+ */
+ if (rel->reloptkind == RELOPT_BASEREL)
+ generate_gather_paths(root, rel);
+
/* Now find the cheapest of the paths for this rel */
set_cheapest(rel);