mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Build "other rels" of appendrel baserels in a separate step.
Up to now, otherrel RelOptInfos were built at the same time as baserel RelOptInfos, thanks to recursion in build_simple_rel(). However, nothing in query_planner's preprocessing cares at all about otherrels, only baserels, so we don't really need to build them until just before we enter make_one_rel. This has two benefits: * create_lateral_join_info did a lot of extra work to propagate lateral-reference information from parents to the correct children. But if we delay creation of the children till after that, it's trivial (and much harder to break, too). * Since we have all the restriction quals correctly assigned to parent appendrels by this point, it'll be possible to do plan-time pruning and never make child RelOptInfos at all for partitions that can be pruned away. That's not done here, but will be later on. Amit Langote, reviewed at various times by Dilip Kumar, Jesper Pedersen, Yoshikazu Imai, and David Rowley Discussion: https://postgr.es/m/9d7c5112-cb99-6a47-d3be-cf1ee6862a1d@lab.ntt.co.jp
This commit is contained in:
@@ -279,6 +279,8 @@ extern void setup_simple_rel_arrays(PlannerInfo *root);
|
||||
extern void setup_append_rel_array(PlannerInfo *root);
|
||||
extern RelOptInfo *build_simple_rel(PlannerInfo *root, int relid,
|
||||
RelOptInfo *parent);
|
||||
extern void add_appendrel_other_rels(PlannerInfo *root, RelOptInfo *rel,
|
||||
Index rti);
|
||||
extern RelOptInfo *find_base_rel(PlannerInfo *root, int relid);
|
||||
extern RelOptInfo *find_join_rel(PlannerInfo *root, Relids relids);
|
||||
extern RelOptInfo *build_join_rel(PlannerInfo *root,
|
||||
|
@@ -65,6 +65,7 @@ extern int from_collapse_limit;
|
||||
extern int join_collapse_limit;
|
||||
|
||||
extern void add_base_rels_to_query(PlannerInfo *root, Node *jtnode);
|
||||
extern void add_other_rels_to_query(PlannerInfo *root);
|
||||
extern void build_base_rel_tlists(PlannerInfo *root, List *final_tlist);
|
||||
extern void add_vars_to_targetlist(PlannerInfo *root, List *vars,
|
||||
Relids where_needed, bool create_new_ph);
|
||||
|
Reference in New Issue
Block a user