forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit689696c
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 parentde8feb1 commit689696c
File tree
4 files changed
+211
-158
lines changed- src
- backend/optimizer
- path
- util
- test/regress
- expected
- sql
4 files changed
+211
-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 |
| |
| |||
1601 | 1591 |
| |
1602 | 1592 |
| |
1603 | 1593 |
| |
1604 |
| - | |
1605 |
| - | |
| 1594 | + | |
1606 | 1595 |
| |
1607 | 1596 |
| |
1608 | 1597 |
| |
1609 | 1598 |
| |
1610 | 1599 |
| |
1611 |
| - | |
1612 |
| - | |
1613 |
| - | |
1614 |
| - | |
1615 | 1600 |
| |
1616 | 1601 |
| |
1617 | 1602 |
| |
1618 | 1603 |
| |
1619 | 1604 |
| |
1620 | 1605 |
| |
1621 |
| - | |
1622 |
| - | |
| 1606 | + | |
1623 | 1607 |
| |
1624 | 1608 |
| |
1625 | 1609 |
| |
| |||
1628 | 1612 |
| |
1629 | 1613 |
| |
1630 | 1614 |
| |
| 1615 | + | |
| 1616 | + | |
1631 | 1617 |
| |
1632 | 1618 |
| |
1633 | 1619 |
| |
1634 |
| - | |
| 1620 | + | |
| 1621 | + | |
1635 | 1622 |
| |
1636 | 1623 |
| |
1637 | 1624 |
| |
| |||
1643 | 1630 |
| |
1644 | 1631 |
| |
1645 | 1632 |
| |
1646 |
| - | |
1647 |
| - | |
1648 |
| - | |
1649 |
| - | |
1650 |
| - | |
1651 |
| - | |
1652 |
| - | |
1653 |
| - | |
1654 |
| - | |
1655 |
| - | |
1656 |
| - | |
1657 |
| - | |
1658 |
| - | |
1659 |
| - | |
1660 |
| - | |
1661 |
| - | |
1662 |
| - | |
1663 |
| - | |
1664 |
| - | |
1665 |
| - | |
1666 |
| - | |
1667 |
| - | |
1668 |
| - | |
1669 |
| - | |
1670 |
| - | |
1671 |
| - | |
| 1633 | + | |
1672 | 1634 |
| |
1673 | 1635 |
| |
1674 |
| - | |
1675 |
| - | |
| 1636 | + | |
| 1637 | + | |
1676 | 1638 |
| |
1677 |
| - | |
1678 |
| - | |
1679 |
| - | |
1680 |
| - | |
1681 |
| - | |
1682 |
| - | |
1683 |
| - | |
| 1639 | + | |
1684 | 1640 |
| |
1685 |
| - | |
| 1641 | + | |
1686 | 1642 |
| |
1687 | 1643 |
| |
1688 | 1644 |
| |
| |||
1753 | 1709 |
| |
1754 | 1710 |
| |
1755 | 1711 |
| |
1756 |
| - | |
1757 |
| - | |
1758 |
| - | |
1759 |
| - | |
1760 |
| - | |
1761 |
| - | |
1762 |
| - | |
1763 |
| - | |
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 | 1712 |
| |
1800 | 1713 |
| |
1801 | 1714 |
| |
|
Lines changed: 46 additions & 54 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1081 | 1081 |
| |
1082 | 1082 |
| |
1083 | 1083 |
| |
| 1084 | + | |
| 1085 | + | |
1084 | 1086 |
| |
1085 | 1087 |
| |
1086 | 1088 |
| |
1087 | 1089 |
| |
1088 |
| - | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
1089 | 1105 |
| |
1090 | 1106 |
| |
1091 | 1107 |
| |
| |||
1117 | 1133 |
| |
1118 | 1134 |
| |
1119 | 1135 |
| |
| 1136 | + | |
| 1137 | + | |
1120 | 1138 |
| |
1121 | 1139 |
| |
1122 | 1140 |
| |
1123 | 1141 |
| |
1124 |
| - | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
1125 | 1157 |
| |
1126 | 1158 |
| |
1127 | 1159 |
| |
| |||
3885 | 3917 |
| |
3886 | 3918 |
| |
3887 | 3919 |
| |
3888 |
| - | |
| 3920 | + | |
| 3921 | + | |
| 3922 | + | |
| 3923 | + | |
| 3924 | + | |
| 3925 | + | |
| 3926 | + | |
| 3927 | + | |
| 3928 | + | |
| 3929 | + | |
| 3930 | + | |
| 3931 | + | |
3889 | 3932 |
| |
3890 | 3933 |
| |
3891 | 3934 |
| |
| |||
3932 | 3975 |
| |
3933 | 3976 |
| |
3934 | 3977 |
| |
3935 |
| - | |
3936 |
| - | |
3937 |
| - | |
3938 |
| - | |
3939 |
| - | |
3940 |
| - | |
3941 |
| - | |
3942 |
| - | |
3943 |
| - | |
3944 |
| - | |
3945 | 3978 |
| |
3946 | 3979 |
| |
3947 | 3980 |
| |
| |||
4032 | 4065 |
| |
4033 | 4066 |
| |
4034 | 4067 |
| |
4035 |
| - | |
4036 |
| - | |
4037 |
| - | |
4038 |
| - | |
4039 |
| - | |
4040 |
| - | |
4041 |
| - | |
4042 |
| - | |
4043 |
| - | |
4044 |
| - | |
4045 |
| - | |
4046 |
| - | |
4047 |
| - | |
4048 |
| - | |
4049 |
| - | |
4050 |
| - | |
4051 |
| - | |
4052 |
| - | |
4053 |
| - | |
4054 |
| - | |
4055 |
| - | |
4056 |
| - | |
4057 |
| - | |
4058 |
| - | |
4059 |
| - | |
4060 |
| - | |
4061 |
| - | |
4062 |
| - | |
4063 |
| - | |
4064 |
| - | |
4065 |
| - | |
4066 | 4068 |
| |
4067 | 4069 |
| |
4068 | 4070 |
| |
| |||
4073 | 4075 |
| |
4074 | 4076 |
| |
4075 | 4077 |
| |
4076 |
| - | |
4077 |
| - | |
4078 |
| - | |
4079 |
| - | |
4080 |
| - | |
4081 |
| - | |
4082 |
| - | |
4083 |
| - | |
4084 |
| - | |
4085 |
| - | |
4086 | 4078 |
| |
4087 | 4079 |
| |
4088 | 4080 |
| |
|
0 commit comments
Comments
(0)