pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Expand partitioned table RTEs level by level, without flattening
Date: Thu, 14 Sep 2017 19:41:55 +0000
Message-ID: <E1dsa1L-0004yv-JL@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Expand partitioned table RTEs level by level, without flattening.

Flattening the partitioning hierarchy at this stage makes various
desirable optimizations difficult.  The original use case for this
patch was partition-wise join, which wants to match up the partitions
in one partitioning hierarchy with those in another such hierarchy.
However, it now seems that it will also be useful in making partition
pruning work using the PartitionDesc rather than constraint exclusion,
because with a flattened expansion, we have no easy way to figure out
which PartitionDescs apply to which leaf tables in a multi-level
partition hierarchy.

As it turns out, we end up creating both rte->inh and !rte->inh RTEs
for each intermediate partitioned table, just as we previously did for
the root table.  This seems unnecessary since the partitioned tables
have no storage and are not scanned.  We might want to go back and
rejigger things so that no partitioned tables (including the parent)
need !rte->inh RTEs, but that seems to require some adjustments not
related to the core purpose of this patch.

Ashutosh Bapat, reviewed by me and by Amit Langote.  Some final
adjustments by me.

Discussion: http://postgr.es/m/CAFjFpRd=1venqLL7oGU=C1dEkuvk2DJgvF+7uKbnPHaum1mvHQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0a480502b092195a9b25a2f0f199a21d592a9c57

Modified Files
--------------
src/backend/optimizer/path/allpaths.c  |  28 ++--
src/backend/optimizer/plan/initsplan.c |  22 +++-
src/backend/optimizer/plan/planner.c   |  80 ++++++++---
src/backend/optimizer/prep/prepunion.c | 234 +++++++++++++++++++--------------
src/include/nodes/relation.h           |   8 +-
src/test/regress/expected/inherit.out  |  22 ++++
src/test/regress/expected/join.out     |  53 ++++++++
src/test/regress/sql/inherit.sql       |  17 +++
src/test/regress/sql/join.sql          |  23 ++++
9 files changed, 350 insertions(+), 137 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 (4+ messages)  latest in thread

Message-ID: <E1dsa1L-0004yv-JL@gemulon.postgresql.org>
Permalink:  ../E1dsa1L-0004yv-JL@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1dsa1L-0004yv-JL@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: rhaas@postgresql.org
  Subject: Re: pgsql: Expand partitioned table RTEs level by level, without flattening
  In-Reply-To: <E1dsa1L-0004yv-JL@gemulon.postgresql.org>
  References: <E1dsa1L-0004yv-JL@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