Expand partitioned tables in PartDesc order.
Robert Haas <rhaas@postgresql.org>
Expand partitioned tables in PartDesc order. Previously, we expanded the inheritance hierarchy in the order in which find_all_inheritors had locked the tables, but that turns out to block quite a bit of useful optimization. For example, a partition-wise join can't count on two tables with matching bounds to get expanded in the same order. Where possible, this change results in expanding partitioned tables in *bound* order. Bound order isn't well-defined for a list-partitioned table with a null-accepting partition or for a list-partitioned table where the bounds for a single partition are interleaved with other partitions. However, when expansion in bound order is possible, it opens up further opportunities for optimization, such as strength-reducing MergeAppend to Append when the expansion order matches the desired sort order. Patch by me, with cosmetic revisions by Ashutosh Bapat. Discussion: http://postgr.es/m/CA+TgmoZrKj7kEzcMSum3aXV4eyvvbh9WD=c6m=002WMheDyE3A@mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/optimizer/prep/prepunion.c | modified | +218 −110 |
| src/test/regress/expected/insert.out | modified | +2 −2 |
Discussion
- expanding inheritance in partition bound order 70 messages · 2017-08-04 → 2017-09-15