pgsql: Get rid of the planner's LateralJoinInfo data structure.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Get rid of the planner's LateralJoinInfo data structure.
Date: 2015-12-11 20:53:17
Message-ID: E1a7Ugn-0004ur-C2@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/4fcf48450d38e28e69e629c779a7866183d8ea41

Modified Files
--------------
src/backend/nodes/copyfuncs.c | 17 ---
src/backend/nodes/equalfuncs.c | 12 ---
src/backend/nodes/outfuncs.c | 14 +--
src/backend/optimizer/path/joinrels.c | 36 ++-----
src/backend/optimizer/plan/analyzejoins.c | 3 -
src/backend/optimizer/plan/initsplan.c | 162 ++++++++++-------------------
src/backend/optimizer/plan/planagg.c | 3 +-
src/backend/optimizer/plan/planmain.c | 6 +-
src/backend/optimizer/plan/planner.c | 3 +-
src/backend/optimizer/prep/prepjointree.c | 9 +-
src/backend/optimizer/prep/prepunion.c | 1 -
src/backend/optimizer/util/placeholder.c | 60 +++--------
src/backend/optimizer/util/relnode.c | 17 +++
src/backend/optimizer/util/var.c | 1 -
src/backend/rewrite/rewriteManip.c | 3 -
src/include/nodes/nodes.h | 1 -
src/include/nodes/relation.h | 41 +-------
17 files changed, 100 insertions(+), 289 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Stephen Frost 2015-12-11 21:12:49 pgsql: Handle policies during DROP OWNED BY
Previous Message Stephen Frost 2015-12-11 20:44:21 pgsql: Handle dependencies properly in ALTER POLICY