pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Get rid of the planner's LateralJoinInfo data structure.
Date: Fri, 11 Dec 2015 20:53:17 +0000
Message-ID: <E1a7Ugn-0004us-C7@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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
------
REL9_5_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/dc4518814ecc2ae319c4d1679ee079e47dbd78e9

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(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


view thread (2+ messages)

Message-ID: <E1a7Ugn-0004us-C7@gemulon.postgresql.org>
Permalink:  ../E1a7Ugn-0004us-C7@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1a7Ugn-0004us-C7@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Get rid of the planner's LateralJoinInfo data structure.
  In-Reply-To: <E1a7Ugn-0004us-C7@gemulon.postgresql.org>
  References: <E1a7Ugn-0004us-C7@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox