mirror of
https://github.com/postgres/postgres.git
synced 2025-08-24 09:27:52 +03:00
Simplify query_planner's API by having it return the top-level RelOptInfo.
Formerly, query_planner returned one or possibly two Paths for the topmost join relation, so that grouping_planner didn't see the join RelOptInfo (at least not directly; it didn't have any hesitation about examining cheapest_path->parent, though). However, correct selection of the Paths involved a significant amount of coupling between query_planner and grouping_planner, a problem which has gotten worse over time. It seems best to give up on this API choice and instead return the topmost RelOptInfo explicitly. Then grouping_planner can pull out the Paths it wants from the rel's path list. In this way we can remove all knowledge of grouping behaviors from query_planner. The only real benefit of the old way is that in the case of an empty FROM clause, we never made any RelOptInfos at all, just a Path. Now we have to gin up a dummy RelOptInfo to represent the empty FROM clause. That's not a very big deal though. While at it, simplify query_planner's API a bit more by having the caller set up root->tuple_fraction and root->limit_tuples, rather than passing those values as separate parameters. Since query_planner no longer does anything with either value, requiring it to fill the PlannerInfo fields seemed pretty arbitrary. This patch just rearranges code; it doesn't (intentionally) change any behaviors. Followup patches will do more interesting things.
This commit is contained in:
@@ -142,6 +142,7 @@ extern RelOptInfo *build_join_rel(PlannerInfo *root,
|
||||
RelOptInfo *inner_rel,
|
||||
SpecialJoinInfo *sjinfo,
|
||||
List **restrictlist_ptr);
|
||||
extern RelOptInfo *build_empty_join_rel(PlannerInfo *root);
|
||||
extern AppendRelInfo *find_childrel_appendrelinfo(PlannerInfo *root,
|
||||
RelOptInfo *rel);
|
||||
extern ParamPathInfo *get_baserel_parampathinfo(PlannerInfo *root,
|
||||
|
@@ -27,11 +27,8 @@ typedef void (*query_pathkeys_callback) (PlannerInfo *root, void *extra);
|
||||
/*
|
||||
* prototypes for plan/planmain.c
|
||||
*/
|
||||
extern void query_planner(PlannerInfo *root, List *tlist,
|
||||
double tuple_fraction, double limit_tuples,
|
||||
query_pathkeys_callback qp_callback, void *qp_extra,
|
||||
Path **cheapest_path, Path **sorted_path,
|
||||
double *num_groups);
|
||||
extern RelOptInfo *query_planner(PlannerInfo *root, List *tlist,
|
||||
query_pathkeys_callback qp_callback, void *qp_extra);
|
||||
|
||||
/*
|
||||
* prototypes for plan/planagg.c
|
||||
|
Reference in New Issue
Block a user