forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitde797e8
committed
Fix bitmap AND/OR scans on the inside of a nestloop partition-wise join.
reparameterize_path_by_child() failed to reparameterize BitmapAndand BitmapOr paths. This matters only if such a path is chosen asthe inside of a nestloop partition-wise join, where we have to passin parameters from the outside of the nestloop. If that did happen,we generated a bad plan that would likely lead to crashes at execution.This is not entirely reparameterize_path_by_child()'s fault though;it's the victim of an ancient decision (my ancient decision, I think)to not bother filling in param_info in BitmapAnd/Or path nodes. Thatcaused the function to believe that such nodes and their childrencontain no parameter references and so need not be processed.In hindsight that decision looks pretty penny-wise and pound-foolish:while it saves a few cycles during path node setup, we do commonlyneed the information later. In particular, by reversing the decisionand requiring valid param_info data in all nodes of a bitmap pathtree, we can get rid of indxpath.c's get_bitmap_tree_required_outer()function, which computed the data on-demand. It's not unlikely thatthat nets out as a savings of cycles in many scenarios. A coupleof other things in indxpath.c can be simplified as well.While here, get rid of some cases in reparameterize_path_by_child()that are visibly dead or useless, given that we only care aboutreparameterizing paths that can be on the inside of a parameterizednestloop. This case reminds one of the maxim that untested codeprobably does not work, so I'm unwilling to leave unreachable codein this function. (I did leave the T_Gather case in place eventhough it's not reached in the regression tests. It's not veryclear to me when the planner might prefer to put Gather belowrather than above a nestloop, but at least in principle the casemight be interesting.)Per bug #16536, originally from Arne Roland but with a test caseby Andrew Gierth. Back-patch to v11 where this code came in.Discussion:https://postgr.es/m/16536-2213ee0b3aad41fd@postgresql.org1 parent1231a0b commitde797e8
File tree
4 files changed
+212
-158
lines changed- src
- backend/optimizer
- path
- util
- test/regress
- expected
- sql
4 files changed
+212
-158
lines changedLines changed: 17 additions & 104 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
122 | 122 |
| |
123 | 123 |
| |
124 | 124 |
| |
125 |
| - | |
126 | 125 |
| |
127 | 126 |
| |
128 | 127 |
| |
| |||
357 | 356 |
| |
358 | 357 |
| |
359 | 358 |
| |
360 |
| - | |
361 | 359 |
| |
362 | 360 |
| |
363 | 361 |
| |
364 |
| - | |
365 |
| - | |
366 |
| - | |
367 |
| - | |
368 |
| - | |
369 |
| - | |
| 362 | + | |
| 363 | + | |
370 | 364 |
| |
371 | 365 |
| |
372 | 366 |
| |
373 |
| - | |
| 367 | + | |
374 | 368 |
| |
375 |
| - | |
376 |
| - | |
377 | 369 |
| |
378 | 370 |
| |
379 | 371 |
| |
| |||
388 | 380 |
| |
389 | 381 |
| |
390 | 382 |
| |
391 |
| - | |
392 | 383 |
| |
393 | 384 |
| |
394 | 385 |
| |
395 |
| - | |
| 386 | + | |
396 | 387 |
| |
397 | 388 |
| |
398 |
| - | |
399 | 389 |
| |
400 |
| - | |
| 390 | + | |
401 | 391 |
| |
402 | 392 |
| |
403 | 393 |
| |
| |||
411 | 401 |
| |
412 | 402 |
| |
413 | 403 |
| |
414 |
| - | |
| 404 | + | |
415 | 405 |
| |
416 | 406 |
| |
417 | 407 |
| |
| |||
1609 | 1599 |
| |
1610 | 1600 |
| |
1611 | 1601 |
| |
1612 |
| - | |
1613 |
| - | |
| 1602 | + | |
1614 | 1603 |
| |
1615 | 1604 |
| |
1616 | 1605 |
| |
1617 | 1606 |
| |
1618 | 1607 |
| |
1619 |
| - | |
1620 |
| - | |
1621 |
| - | |
1622 |
| - | |
1623 | 1608 |
| |
1624 | 1609 |
| |
1625 | 1610 |
| |
1626 | 1611 |
| |
1627 | 1612 |
| |
1628 | 1613 |
| |
1629 |
| - | |
1630 |
| - | |
| 1614 | + | |
1631 | 1615 |
| |
1632 | 1616 |
| |
1633 | 1617 |
| |
| |||
1636 | 1620 |
| |
1637 | 1621 |
| |
1638 | 1622 |
| |
| 1623 | + | |
| 1624 | + | |
1639 | 1625 |
| |
1640 | 1626 |
| |
1641 | 1627 |
| |
1642 |
| - | |
| 1628 | + | |
| 1629 | + | |
1643 | 1630 |
| |
1644 | 1631 |
| |
1645 | 1632 |
| |
| |||
1651 | 1638 |
| |
1652 | 1639 |
| |
1653 | 1640 |
| |
1654 |
| - | |
1655 |
| - | |
1656 |
| - | |
1657 |
| - | |
1658 |
| - | |
1659 |
| - | |
1660 |
| - | |
1661 |
| - | |
1662 |
| - | |
1663 |
| - | |
1664 |
| - | |
1665 |
| - | |
1666 |
| - | |
1667 |
| - | |
1668 |
| - | |
1669 |
| - | |
1670 |
| - | |
1671 |
| - | |
1672 |
| - | |
1673 |
| - | |
1674 |
| - | |
1675 |
| - | |
1676 |
| - | |
1677 |
| - | |
1678 |
| - | |
1679 |
| - | |
| 1641 | + | |
1680 | 1642 |
| |
1681 | 1643 |
| |
1682 |
| - | |
1683 |
| - | |
| 1644 | + | |
| 1645 | + | |
1684 | 1646 |
| |
1685 |
| - | |
1686 |
| - | |
1687 |
| - | |
1688 |
| - | |
1689 |
| - | |
1690 |
| - | |
1691 |
| - | |
| 1647 | + | |
1692 | 1648 |
| |
1693 |
| - | |
| 1649 | + | |
1694 | 1650 |
| |
1695 | 1651 |
| |
1696 | 1652 |
| |
| |||
1761 | 1717 |
| |
1762 | 1718 |
| |
1763 | 1719 |
| |
1764 |
| - | |
1765 |
| - | |
1766 |
| - | |
1767 |
| - | |
1768 |
| - | |
1769 |
| - | |
1770 |
| - | |
1771 |
| - | |
1772 |
| - | |
1773 |
| - | |
1774 |
| - | |
1775 |
| - | |
1776 |
| - | |
1777 |
| - | |
1778 |
| - | |
1779 |
| - | |
1780 |
| - | |
1781 |
| - | |
1782 |
| - | |
1783 |
| - | |
1784 |
| - | |
1785 |
| - | |
1786 |
| - | |
1787 |
| - | |
1788 |
| - | |
1789 |
| - | |
1790 |
| - | |
1791 |
| - | |
1792 |
| - | |
1793 |
| - | |
1794 |
| - | |
1795 |
| - | |
1796 |
| - | |
1797 |
| - | |
1798 |
| - | |
1799 |
| - | |
1800 |
| - | |
1801 |
| - | |
1802 |
| - | |
1803 |
| - | |
1804 |
| - | |
1805 |
| - | |
1806 |
| - | |
1807 | 1720 |
| |
1808 | 1721 |
| |
1809 | 1722 |
| |
|
Lines changed: 46 additions & 54 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1107 | 1107 |
| |
1108 | 1108 |
| |
1109 | 1109 |
| |
| 1110 | + | |
| 1111 | + | |
1110 | 1112 |
| |
1111 | 1113 |
| |
1112 | 1114 |
| |
1113 | 1115 |
| |
1114 |
| - | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
1115 | 1131 |
| |
1116 | 1132 |
| |
1117 | 1133 |
| |
| |||
1143 | 1159 |
| |
1144 | 1160 |
| |
1145 | 1161 |
| |
| 1162 | + | |
| 1163 | + | |
1146 | 1164 |
| |
1147 | 1165 |
| |
1148 | 1166 |
| |
1149 | 1167 |
| |
1150 |
| - | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
1151 | 1183 |
| |
1152 | 1184 |
| |
1153 | 1185 |
| |
| |||
3851 | 3883 |
| |
3852 | 3884 |
| |
3853 | 3885 |
| |
3854 |
| - | |
| 3886 | + | |
| 3887 | + | |
| 3888 | + | |
| 3889 | + | |
| 3890 | + | |
| 3891 | + | |
| 3892 | + | |
| 3893 | + | |
| 3894 | + | |
| 3895 | + | |
| 3896 | + | |
| 3897 | + | |
3855 | 3898 |
| |
3856 | 3899 |
| |
3857 | 3900 |
| |
| |||
3898 | 3941 |
| |
3899 | 3942 |
| |
3900 | 3943 |
| |
3901 |
| - | |
3902 |
| - | |
3903 |
| - | |
3904 |
| - | |
3905 |
| - | |
3906 |
| - | |
3907 |
| - | |
3908 |
| - | |
3909 |
| - | |
3910 |
| - | |
3911 | 3944 |
| |
3912 | 3945 |
| |
3913 | 3946 |
| |
| |||
3998 | 4031 |
| |
3999 | 4032 |
| |
4000 | 4033 |
| |
4001 |
| - | |
4002 |
| - | |
4003 |
| - | |
4004 |
| - | |
4005 |
| - | |
4006 |
| - | |
4007 |
| - | |
4008 |
| - | |
4009 |
| - | |
4010 |
| - | |
4011 |
| - | |
4012 |
| - | |
4013 |
| - | |
4014 |
| - | |
4015 |
| - | |
4016 |
| - | |
4017 |
| - | |
4018 |
| - | |
4019 |
| - | |
4020 |
| - | |
4021 |
| - | |
4022 |
| - | |
4023 |
| - | |
4024 |
| - | |
4025 |
| - | |
4026 |
| - | |
4027 |
| - | |
4028 |
| - | |
4029 |
| - | |
4030 |
| - | |
4031 |
| - | |
4032 | 4034 |
| |
4033 | 4035 |
| |
4034 | 4036 |
| |
| |||
4039 | 4041 |
| |
4040 | 4042 |
| |
4041 | 4043 |
| |
4042 |
| - | |
4043 |
| - | |
4044 |
| - | |
4045 |
| - | |
4046 |
| - | |
4047 |
| - | |
4048 |
| - | |
4049 |
| - | |
4050 |
| - | |
4051 |
| - | |
4052 | 4044 |
| |
4053 | 4045 |
| |
4054 | 4046 |
| |
|
0 commit comments
Comments
(0)