From 4fcf48450d38e28e69e629c779a7866183d8ea41 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 11 Dec 2015 15:52:16 -0500 Subject: Get rid of the planner's LateralJoinInfo data structure. I originally modeled this data structure on SpecialJoinInfo, but after commit acfcd45cacb6df23 that looks like a pretty poor decision. All we really need is relid sets identifying laterally-referenced rels; and most of the time, what we want to know about includes indirect lateral references, a case the LateralJoinInfo data was unsuited to compute with any efficiency. The previous commit redefined RelOptInfo.lateral_relids as the transitive closure of lateral references, so that it easily supports checking indirect references. For the places where we really do want just direct references, add a new RelOptInfo field direct_lateral_relids, which is easily set up as a copy of lateral_relids before we perform the transitive closure calculation. Then we can just drop lateral_info_list and LateralJoinInfo and the supporting code. This makes the planner's handling of lateral references noticeably more efficient, and shorter too. Such a change can't be back-patched into stable branches for fear of breaking extensions that might be looking at the planner's data structures; but it seems not too late to push it into 9.5, so I've done so. --- src/backend/optimizer/plan/planmain.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/backend/optimizer/plan/planmain.c') diff --git a/src/backend/optimizer/plan/planmain.c b/src/backend/optimizer/plan/planmain.c index d73e7c0ab0f..894f9685e0f 100644 --- a/src/backend/optimizer/plan/planmain.c +++ b/src/backend/optimizer/plan/planmain.c @@ -114,7 +114,6 @@ query_planner(PlannerInfo *root, List *tlist, root->right_join_clauses = NIL; root->full_join_clauses = NIL; root->join_info_list = NIL; - root->lateral_info_list = NIL; root->placeholder_list = NIL; root->initial_rels = NIL; @@ -201,9 +200,8 @@ query_planner(PlannerInfo *root, List *tlist, add_placeholders_to_base_rels(root); /* - * Create the LateralJoinInfo list now that we have finalized - * PlaceHolderVar eval levels and made any necessary additions to the - * lateral_vars lists for lateral references within PlaceHolderVars. + * Construct the lateral reference sets now that we have finalized + * PlaceHolderVar eval levels. */ create_lateral_join_info(root); -- cgit v1.2.3