]> granicus.if.org Git - postgresql/commit
Don't scan partitioned tables.
authorRobert Haas <rhaas@postgresql.org>
Tue, 21 Mar 2017 13:48:04 +0000 (09:48 -0400)
committerRobert Haas <rhaas@postgresql.org>
Tue, 21 Mar 2017 13:48:04 +0000 (09:48 -0400)
commitd3cc37f1d801a6b5cad9bf179274a8d767f1ee50
tree88dd5a0133f46b2eb015b4fd2ce69f1b3c30bb56
parentd5286aa905c9173b3fc4f911682089149bd3caef
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
27 files changed:
src/backend/executor/execMain.c
src/backend/executor/execParallel.c
src/backend/executor/execUtils.c
src/backend/executor/nodeAppend.c
src/backend/executor/nodeMergeAppend.c
src/backend/executor/nodeModifyTable.c
src/backend/nodes/copyfuncs.c
src/backend/nodes/equalfuncs.c
src/backend/nodes/outfuncs.c
src/backend/nodes/readfuncs.c
src/backend/optimizer/path/allpaths.c
src/backend/optimizer/path/joinrels.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/planner.c
src/backend/optimizer/plan/setrefs.c
src/backend/optimizer/prep/prepunion.c
src/backend/optimizer/util/pathnode.c
src/backend/utils/cache/plancache.c
src/include/executor/executor.h
src/include/nodes/nodes.h
src/include/nodes/plannodes.h
src/include/nodes/relation.h
src/include/optimizer/pathnode.h
src/include/optimizer/planner.h
src/test/regress/expected/inherit.out
src/test/regress/expected/tablesample.out
src/test/regress/sql/inherit.sql