forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite9f0311
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 parentd2761b6 commite9f0311
File tree
4 files changed
+218
-162
lines changed- src
- backend/optimizer
- path
- util
- test/regress
- expected
- sql
4 files changed
+218
-162
lines changedLines changed: 17 additions & 104 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
126 | 126 |
| |
127 | 127 |
| |
128 | 128 |
| |
129 |
| - | |
130 | 129 |
| |
131 | 130 |
| |
132 | 131 |
| |
| |||
356 | 355 |
| |
357 | 356 |
| |
358 | 357 |
| |
359 |
| - | |
360 | 358 |
| |
361 | 359 |
| |
362 | 360 |
| |
363 |
| - | |
364 |
| - | |
365 |
| - | |
366 |
| - | |
367 |
| - | |
368 |
| - | |
| 361 | + | |
| 362 | + | |
369 | 363 |
| |
370 | 364 |
| |
371 | 365 |
| |
372 |
| - | |
| 366 | + | |
373 | 367 |
| |
374 |
| - | |
375 |
| - | |
376 | 368 |
| |
377 | 369 |
| |
378 | 370 |
| |
| |||
387 | 379 |
| |
388 | 380 |
| |
389 | 381 |
| |
390 |
| - | |
391 | 382 |
| |
392 | 383 |
| |
393 | 384 |
| |
394 |
| - | |
| 385 | + | |
395 | 386 |
| |
396 | 387 |
| |
397 |
| - | |
398 | 388 |
| |
399 |
| - | |
| 389 | + | |
400 | 390 |
| |
401 | 391 |
| |
402 | 392 |
| |
| |||
410 | 400 |
| |
411 | 401 |
| |
412 | 402 |
| |
413 |
| - | |
| 403 | + | |
414 | 404 |
| |
415 | 405 |
| |
416 | 406 |
| |
| |||
1611 | 1601 |
| |
1612 | 1602 |
| |
1613 | 1603 |
| |
1614 |
| - | |
1615 |
| - | |
| 1604 | + | |
1616 | 1605 |
| |
1617 | 1606 |
| |
1618 | 1607 |
| |
1619 | 1608 |
| |
1620 | 1609 |
| |
1621 |
| - | |
1622 |
| - | |
1623 |
| - | |
1624 |
| - | |
1625 | 1610 |
| |
1626 | 1611 |
| |
1627 | 1612 |
| |
1628 | 1613 |
| |
1629 | 1614 |
| |
1630 | 1615 |
| |
1631 |
| - | |
1632 |
| - | |
| 1616 | + | |
1633 | 1617 |
| |
1634 | 1618 |
| |
1635 | 1619 |
| |
| |||
1638 | 1622 |
| |
1639 | 1623 |
| |
1640 | 1624 |
| |
| 1625 | + | |
| 1626 | + | |
1641 | 1627 |
| |
1642 | 1628 |
| |
1643 | 1629 |
| |
1644 |
| - | |
| 1630 | + | |
| 1631 | + | |
1645 | 1632 |
| |
1646 | 1633 |
| |
1647 | 1634 |
| |
| |||
1653 | 1640 |
| |
1654 | 1641 |
| |
1655 | 1642 |
| |
1656 |
| - | |
1657 |
| - | |
1658 |
| - | |
1659 |
| - | |
1660 |
| - | |
1661 |
| - | |
1662 |
| - | |
1663 |
| - | |
1664 |
| - | |
1665 |
| - | |
1666 |
| - | |
1667 |
| - | |
1668 |
| - | |
1669 |
| - | |
1670 |
| - | |
1671 |
| - | |
1672 |
| - | |
1673 |
| - | |
1674 |
| - | |
1675 |
| - | |
1676 |
| - | |
1677 |
| - | |
1678 |
| - | |
1679 |
| - | |
1680 |
| - | |
1681 |
| - | |
| 1643 | + | |
1682 | 1644 |
| |
1683 | 1645 |
| |
1684 |
| - | |
1685 |
| - | |
| 1646 | + | |
| 1647 | + | |
1686 | 1648 |
| |
1687 |
| - | |
1688 |
| - | |
1689 |
| - | |
1690 |
| - | |
1691 |
| - | |
1692 |
| - | |
1693 |
| - | |
| 1649 | + | |
1694 | 1650 |
| |
1695 |
| - | |
| 1651 | + | |
1696 | 1652 |
| |
1697 | 1653 |
| |
1698 | 1654 |
| |
| |||
1763 | 1719 |
| |
1764 | 1720 |
| |
1765 | 1721 |
| |
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 |
| - | |
1808 |
| - | |
1809 | 1722 |
| |
1810 | 1723 |
| |
1811 | 1724 |
| |
|
Lines changed: 46 additions & 58 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1118 | 1118 |
| |
1119 | 1119 |
| |
1120 | 1120 |
| |
| 1121 | + | |
| 1122 | + | |
1121 | 1123 |
| |
1122 | 1124 |
| |
1123 | 1125 |
| |
1124 | 1126 |
| |
1125 |
| - | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
1126 | 1142 |
| |
1127 | 1143 |
| |
1128 | 1144 |
| |
| |||
1154 | 1170 |
| |
1155 | 1171 |
| |
1156 | 1172 |
| |
| 1173 | + | |
| 1174 | + | |
1157 | 1175 |
| |
1158 | 1176 |
| |
1159 | 1177 |
| |
1160 | 1178 |
| |
1161 |
| - | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
1162 | 1194 |
| |
1163 | 1195 |
| |
1164 | 1196 |
| |
| |||
3686 | 3718 |
| |
3687 | 3719 |
| |
3688 | 3720 |
| |
3689 |
| - | |
| 3721 | + | |
| 3722 | + | |
| 3723 | + | |
| 3724 | + | |
| 3725 | + | |
| 3726 | + | |
| 3727 | + | |
| 3728 | + | |
| 3729 | + | |
| 3730 | + | |
| 3731 | + | |
| 3732 | + | |
3690 | 3733 |
| |
3691 | 3734 |
| |
3692 | 3735 |
| |
| |||
3734 | 3777 |
| |
3735 | 3778 |
| |
3736 | 3779 |
| |
3737 |
| - | |
3738 |
| - | |
3739 |
| - | |
3740 |
| - | |
3741 |
| - | |
3742 |
| - | |
3743 |
| - | |
3744 |
| - | |
3745 |
| - | |
3746 |
| - | |
3747 |
| - | |
3748 |
| - | |
3749 |
| - | |
3750 |
| - | |
3751 | 3780 |
| |
3752 | 3781 |
| |
3753 | 3782 |
| |
| |||
3838 | 3867 |
| |
3839 | 3868 |
| |
3840 | 3869 |
| |
3841 |
| - | |
3842 |
| - | |
3843 |
| - | |
3844 |
| - | |
3845 |
| - | |
3846 |
| - | |
3847 |
| - | |
3848 |
| - | |
3849 |
| - | |
3850 |
| - | |
3851 |
| - | |
3852 |
| - | |
3853 |
| - | |
3854 |
| - | |
3855 |
| - | |
3856 |
| - | |
3857 |
| - | |
3858 |
| - | |
3859 |
| - | |
3860 |
| - | |
3861 |
| - | |
3862 |
| - | |
3863 |
| - | |
3864 |
| - | |
3865 |
| - | |
3866 |
| - | |
3867 |
| - | |
3868 |
| - | |
3869 |
| - | |
3870 |
| - | |
3871 |
| - | |
3872 | 3870 |
| |
3873 | 3871 |
| |
3874 | 3872 |
| |
| |||
3879 | 3877 |
| |
3880 | 3878 |
| |
3881 | 3879 |
| |
3882 |
| - | |
3883 |
| - | |
3884 |
| - | |
3885 |
| - | |
3886 |
| - | |
3887 |
| - | |
3888 |
| - | |
3889 |
| - | |
3890 |
| - | |
3891 |
| - | |
3892 | 3880 |
| |
3893 | 3881 |
| |
3894 | 3882 |
| |
|
0 commit comments
Comments
(0)