postgresql/src/backend/partitioning
Tom Lane 428b260f87 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
2019-03-30 18:58:55 -04:00
..
Makefile Move code for managing PartitionDescs into a new file, partdesc.c 2019-02-21 11:45:02 -05:00
partbounds.c Fix misplaced const 2019-03-26 09:23:08 +01:00
partdesc.c Update copyright year in files added by 1bb5e78218. 2019-03-16 16:00:38 +05:30
partprune.c Speed up planning when partitions can be pruned at plan time. 2019-03-30 18:58:55 -04:00