Teach planner to convert simple UNION ALL subqueries into append relations,
Tom Lane <tgl@sss.pgh.pa.us>
Teach planner to convert simple UNION ALL subqueries into append relations, thereby sharing code with the inheritance case. This puts the UNION-ALL-view approach to partitioned tables on par with inheritance, so far as constraint exclusion is concerned: it works either way. (Still need to update the docs to say so.) The definition of "simple UNION ALL" is a little simpler than I would like --- basically the union arms can only be SELECT * FROM foo --- but it's good enough for partitioned-table cases.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/optimizer/path/allpaths.c | modified | +50 −30 |
| src/backend/optimizer/path/joinpath.c | modified | +4 −25 |
| src/backend/optimizer/plan/planner.c | modified | +2 −2 |
| src/backend/optimizer/prep/prepjointree.c | modified | +604 −226 |
| src/backend/optimizer/prep/prepunion.c | modified | +35 −94 |
| src/backend/optimizer/util/relnode.c | modified | +143 −1 |
| src/backend/optimizer/util/tlist.c | modified | +37 −1 |
| src/include/optimizer/pathnode.h | modified | +8 −1 |
| src/include/optimizer/prep.h | modified | +2 −7 |
| src/include/optimizer/tlist.h | modified | +3 −1 |