From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Don't scan partitioned tables.
Date: Tue, 21 Mar 2017 13:48:08 +0000
Message-ID: <E1cqK8u-0001IS-Ct@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
Don't scan partitioned tables.
Partitioned tables do not contain any data; only their unpartitioned
descendents need to be scanned. However, the partitioned tables still
need to be locked, even though they're not scanned. To make that
work, Append and MergeAppend relations now need to carry a list of
(unscanned) partitioned relations that must be locked, and InitPlan
must lock all partitioned result relations.
Aside from the obvious advantage of avoiding some work at execution
time, this has two other advantages. First, it may improve the
planner's decision-making in some cases since the empty relation
might throw things off. Second, it paves the way to getting rid of
the storage for partitioned tables altogether.
Amit Langote, reviewed by me.
Discussion: http://postgr.es/m/6837c359-45c4-8044-34d1-736756335a15@lab.ntt.co.jp
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/d3cc37f1d801a6b5cad9bf179274a8d767f1ee50
Modified Files
--------------
src/backend/executor/execMain.c | 22 ++++-
src/backend/executor/execParallel.c | 1 +
src/backend/executor/execUtils.c | 56 ++++++++++++
src/backend/executor/nodeAppend.c | 6 ++
src/backend/executor/nodeMergeAppend.c | 6 ++
src/backend/executor/nodeModifyTable.c | 19 +++-
src/backend/nodes/copyfuncs.c | 21 +++++
src/backend/nodes/equalfuncs.c | 12 +++
src/backend/nodes/outfuncs.c | 21 +++++
src/backend/nodes/readfuncs.c | 4 +
src/backend/optimizer/path/allpaths.c | 43 +++++++--
src/backend/optimizer/path/joinrels.c | 2 +-
src/backend/optimizer/plan/createplan.c | 14 ++-
src/backend/optimizer/plan/planner.c | 89 +++++++++++++++---
src/backend/optimizer/plan/setrefs.c | 21 +++++
src/backend/optimizer/prep/prepunion.c | 103 ++++++++++++++-------
src/backend/optimizer/util/pathnode.c | 10 +-
src/backend/utils/cache/plancache.c | 3 +-
src/include/executor/executor.h | 1 +
src/include/nodes/nodes.h | 1 +
src/include/nodes/plannodes.h | 20 +++-
src/include/nodes/relation.h | 37 +++++++-
src/include/optimizer/pathnode.h | 8 +-
src/include/optimizer/planner.h | 2 +
src/test/regress/expected/inherit.out | 147 +++++++++++++-----------------
src/test/regress/expected/tablesample.out | 4 +-
src/test/regress/sql/inherit.sql | 28 ++++++
27 files changed, 537 insertions(+), 164 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
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: Don't scan partitioned tables.
In-Reply-To: <E1cqK8u-0001IS-Ct@gemulon.postgresql.org>
References: <E1cqK8u-0001IS-Ct@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