pgsql: Build "other rels" of appendrel baserels in a separate step.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Build "other rels" of appendrel baserels in a separate step.
Date: 2019-03-26 22:21:18
Message-ID: E1h8uRa-0004Wb-0X@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/53bcf5e3dbeaed5baf9d09b124cf196d247c54ea

Modified Files
--------------
src/backend/optimizer/path/allpaths.c | 2 +-
src/backend/optimizer/plan/initsplan.c | 94 ++++++++++-------------
src/backend/optimizer/plan/planmain.c | 24 ++++--
src/backend/optimizer/util/relnode.c | 132 ++++++++++++++++++++++-----------
src/include/optimizer/pathnode.h | 2 +
src/include/optimizer/planmain.h | 1 +
6 files changed, 150 insertions(+), 105 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2019-03-26 23:25:31 pgsql: Fix partitioned index creation bug with dropped columns
Previous Message Tom Lane 2019-03-26 21:46:16 pgsql: Add ORDER BY to more ICU regression test cases.