pgsql: Add GUC enable_partition_pruning

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add GUC enable_partition_pruning
Date: 2018-04-23 20:59:43
Message-ID: E1fAiYp-0002Ob-0D@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add GUC enable_partition_pruning

This controls both plan-time and execution-time new-style partition
pruning. While finer-grain control is possible (maybe using an enum GUC
instead of boolean), there doesn't seem to be much need for that.

This new parameter controls partition pruning for all queries:
trivially, SELECT queries that affect partitioned tables are naturally
under its control since they are using the new technology. However,
while UPDATE/DELETE queries do not use the new code, we make the new GUC
control their behavior also (stealing control from
constraint_exclusion), because it is more natural, and it leads to a
more natural transition to the future in which those queries will also
use the new pruning code.

Constraint exclusion still controls pruning for regular inheritance
situations (those not involving partitioned tables).

Author: David Rowley
Review: Amit Langote, Ashutosh Bapat, Justin Pryzby, David G. Johnston
Discussion: https://postgr.es/m/CAKJS1f_0HwsxJG9m+nzU+CizxSdGtfe6iF_ykPYBiYft302DCw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/055fb8d33da6ff9003e3da4b9944bdcd2e2b2a49

Modified Files
--------------
doc/src/sgml/config.sgml | 30 +++--
doc/src/sgml/ddl.sgml | 2 +-
src/backend/nodes/outfuncs.c | 2 +-
src/backend/optimizer/path/allpaths.c | 3 +-
src/backend/optimizer/path/costsize.c | 1 +
src/backend/optimizer/plan/createplan.c | 7 +-
src/backend/optimizer/plan/planner.c | 11 +-
src/backend/optimizer/prep/prepjointree.c | 2 +-
src/backend/optimizer/util/plancat.c | 45 +++++--
src/backend/utils/misc/guc.c | 11 ++
src/backend/utils/misc/postgresql.conf.sample | 1 +
src/include/nodes/relation.h | 16 ++-
src/include/optimizer/cost.h | 1 +
src/test/regress/expected/partition_prune.out | 164 ++++++++++++++++++++++++++
src/test/regress/expected/sysviews.out | 3 +-
src/test/regress/sql/partition_prune.sql | 52 ++++++++
16 files changed, 322 insertions(+), 29 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message David Rowley 2018-04-24 00:27:27 Re: pgsql: Remove useless default clause in switch
Previous Message Tom Lane 2018-04-23 19:29:25 pgsql: Fix handling of partition bounds for boolean partitioning column