git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: ad3107b) | patch
Speed up planning when partitions can be pruned at plan time.
2019年3月30日 22:58:55 +0000 (18:58 -0400)
2019年3月30日 22:58:55 +0000 (18:58 -0400)
commit 428b260f87e8861ba8e58807b69d433db491c4f4
Speed up planning when partitions can be pruned at plan time.

Previously, the planner created RangeTblEntry and RelOptInfo structs
for every partition of a partitioned table, even though many of them
might later be deemed uninteresting thanks to partition pruning logic.
This incurred significant overhead when there are many partitions.
Arrange to postpone creation of these data structures until after
we've processed the query enough to identify restriction quals for
the partitioned table, and then apply partition pruning before not
after creation of each partition's data structures. In this way
we need not open the partition relations at all for partitions that
the planner has no real interest in.

For queries that can be proven at plan time to access only a small
number of partitions, this patch improves the practical maximum
number of partitions from under 100 to perhaps a few thousand.

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
16 files changed:
contrib/postgres_fdw/expected/postgres_fdw.out diff | blob | blame | history
src/backend/executor/execPartition.c diff | blob | blame | history
src/backend/optimizer/path/allpaths.c diff | blob | blame | history
src/backend/optimizer/plan/initsplan.c diff | blob | blame | history
src/backend/optimizer/plan/planner.c diff | blob | blame | history
src/backend/optimizer/prep/preptlist.c diff | blob | blame | history
src/backend/optimizer/util/inherit.c diff | blob | blame | history
src/backend/optimizer/util/plancat.c diff | blob | blame | history
src/backend/optimizer/util/relnode.c diff | blob | blame | history
src/backend/partitioning/partprune.c diff | blob | blame | history
src/include/nodes/plannodes.h diff | blob | blame | history
src/include/optimizer/inherit.h diff | blob | blame | history
src/include/optimizer/pathnode.h diff | blob | blame | history
src/test/regress/expected/partition_aggregate.out diff | blob | blame | history
src/test/regress/expected/partition_prune.out diff | blob | blame | history
src/test/regress/sql/partition_prune.sql diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /