forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8edd0e7
committed
Suppress Append and MergeAppend plan nodes that have a single child.
If there's only one child relation, the Append or MergeAppend isn'tdoing anything useful, and can be elided. It does have a purposeduring planning though, which is to serve as a buffer between parentand child Var numbering. Therefore we keep it all the way throughto setrefs.c, and get rid of it only after fixing references in theplan level(s) above it. This works largely the same as setrefs.c'sancient hack to get rid of no-op SubqueryScan nodes, and can evenshare some code with that.Note the change to make setrefs.c use apply_tlist_labeling rather thanad-hoc code. This has the effect of propagating the child's resjunkand ressortgroupref labels, which formerly weren't propagated whenremoving a SubqueryScan. Doing that is demonstrably necessary forthe [Merge]Append cases, and seems harmless for SubqueryScan, if onlybecause trivial_subqueryscan is afraid to collapse cases where theresjunk marking differs. (I suspect that restriction could now beremoved, though it's unclear that it'd make any new matches possible,since the outer query can't have references to a child resjunk column.)David Rowley, reviewed by Alvaro Herrera and Tomas VondraDiscussion:https://postgr.es/m/CAKJS1f_7u8ATyJ1JGTMHFoKDvZdeF-iEBhs+sM_SXowOr9cArg@mail.gmail.com1 parentf21668f commit8edd0e7
File tree
12 files changed
+598
-496
lines changed- contrib/postgres_fdw
- expected
- sql
- src
- backend
- executor
- optimizer
- path
- plan
- util
- test/regress/expected
12 files changed
+598
-496
lines changedLines changed: 9 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8427 | 8427 |
| |
8428 | 8428 |
| |
8429 | 8429 |
| |
8430 |
| - | |
8431 |
| - | |
| 8430 | + | |
| 8431 | + | |
8432 | 8432 |
| |
8433 |
| - | |
8434 |
| - | |
8435 |
| - | |
8436 |
| - | |
8437 |
| - | |
8438 |
| - | |
8439 |
| - | |
8440 |
| - | |
| 8433 | + | |
| 8434 | + | |
| 8435 | + | |
| 8436 | + | |
| 8437 | + | |
| 8438 | + | |
| 8439 | + | |
8441 | 8440 |
| |
8442 | 8441 |
| |
8443 | 8442 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2309 | 2309 |
| |
2310 | 2310 |
| |
2311 | 2311 |
| |
2312 |
| - | |
2313 |
| - | |
| 2312 | + | |
| 2313 | + | |
2314 | 2314 |
| |
2315 | 2315 |
| |
2316 | 2316 |
| |
|
Lines changed: 30 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
447 | 447 |
| |
448 | 448 |
| |
449 | 449 |
| |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
450 | 480 |
| |
451 | 481 |
| |
452 | 482 |
| |
|
Lines changed: 34 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1044 | 1044 |
| |
1045 | 1045 |
| |
1046 | 1046 |
| |
1047 |
| - | |
1048 |
| - | |
| 1047 | + | |
| 1048 | + | |
1049 | 1049 |
| |
1050 | 1050 |
| |
1051 | 1051 |
| |
| |||
1708 | 1708 |
| |
1709 | 1709 |
| |
1710 | 1710 |
| |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
1711 | 1743 |
| |
1712 | 1744 |
| |
1713 | 1745 |
| |
|
Lines changed: 4 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1134 | 1134 |
| |
1135 | 1135 |
| |
1136 | 1136 |
| |
1137 |
| - | |
1138 |
| - | |
1139 |
| - | |
1140 |
| - | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
1141 | 1141 |
| |
1142 | 1142 |
| |
1143 | 1143 |
| |
|
0 commit comments
Comments
(0)