summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/optimizer/plan/planner.c10
-rw-r--r--src/include/nodes/pathnodes.h18
2 files changed, 26 insertions, 2 deletions
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index 3a1b846217..c430189572 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -1830,6 +1830,7 @@ grouping_planner(PlannerInfo *root, bool inheritance_update,
bool final_target_parallel_safe;
RelOptInfo *current_rel;
RelOptInfo *final_rel;
+ FinalPathExtraData extra;
ListCell *lc;
/* Tweak caller-supplied tuple_fraction if have LIMIT/OFFSET */
@@ -2389,6 +2390,11 @@ grouping_planner(PlannerInfo *root, bool inheritance_update,
}
}
+ extra.limit_needed = limit_needed(parse);
+ extra.limit_tuples = limit_tuples;
+ extra.count_est = count_est;
+ extra.offset_est = offset_est;
+
/*
* If there is an FDW that's responsible for all baserels of the query,
* let it consider adding ForeignPaths.
@@ -2397,12 +2403,12 @@ grouping_planner(PlannerInfo *root, bool inheritance_update,
final_rel->fdwroutine->GetForeignUpperPaths)
final_rel->fdwroutine->GetForeignUpperPaths(root, UPPERREL_FINAL,
current_rel, final_rel,
- NULL);
+ &extra);
/* Let extensions possibly add some more paths */
if (create_upper_paths_hook)
(*create_upper_paths_hook) (root, UPPERREL_FINAL,
- current_rel, final_rel, NULL);
+ current_rel, final_rel, &extra);
/* Note: currently, we leave it to callers to do set_cheapest() */
}
diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h
index 88c8973f3c..15314a8cfe 100644
--- a/src/include/nodes/pathnodes.h
+++ b/src/include/nodes/pathnodes.h
@@ -2440,6 +2440,24 @@ typedef struct
} GroupPathExtraData;
/*
+ * Struct for extra information passed to subroutines of grouping_planner
+ *
+ * limit_needed is true if we actually need a Limit plan node
+ * limit_tuples is an estimated bound on the number of output tuples,
+ * or -1 if no LIMIT or couldn't estimate
+ * count_est and offset_est are the estimated values of the LIMIT and OFFSET
+ * expressions computed by preprocess_limit() (see comments for
+ * preprocess_limit() for more information).
+ */
+typedef struct
+{
+ bool limit_needed;
+ double limit_tuples;
+ int64 count_est;
+ int64 offset_est;
+} FinalPathExtraData;
+
+/*
* For speed reasons, cost estimation for join paths is performed in two
* phases: the first phase tries to quickly derive a lower bound for the
* join cost, and then we check if that's sufficient to reject the path.