forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7e6fb5d
committed
Improvements and fixes fore0b1ee1
e0b1ee1 introduced optimization for matching B-tree scan keys required forthe directional scan. However, it incorrectly assumed that all keys requiredfor opposite direction scan are satisfied by _bt_first(). It has beenillustrated that with multiple scan keys over the same column, a lesser one(according to the scan direction) could win leaving the other one unsatisfied.Instead of relying on _bt_first() this commit introduces code that memorizeswhether there was at least one match on the page. If that's true we know thatkeys required for opposite-direction scan are satisfied as soon ascorresponding values are not NULLs.Also, this commit simplifies the description for the optimization of keysrequired for the current direction scan. Now the flag used for this is namedcontinuescanPrechecked and means exactly that *continuescan flag is knownto be true for the last item on the page.Reported-by: Peter GeogheganDiscussion:https://postgr.es/m/CAH2-Wzn0LeLcb1PdBnK0xisz8NpHkxRrMr3NWJ%2BKOK-WZ%2BQtTQ%40mail.gmail.comReviewed-by: Pavel Borisov1 parent06b10f8 commit7e6fb5d
File tree
3 files changed
+51
-33
lines changed- src
- backend/access/nbtree
- include/access
3 files changed
+51
-33
lines changedLines changed: 24 additions & 18 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1530 | 1530 |
| |
1531 | 1531 |
| |
1532 | 1532 |
| |
1533 |
| - | |
| 1533 | + | |
| 1534 | + | |
1534 | 1535 |
| |
1535 | 1536 |
| |
1536 | 1537 |
| |
| |||
1585 | 1586 |
| |
1586 | 1587 |
| |
1587 | 1588 |
| |
1588 |
| - | |
1589 |
| - | |
1590 |
| - | |
1591 |
| - | |
1592 |
| - | |
1593 |
| - | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
1594 | 1594 |
| |
1595 | 1595 |
| |
1596 | 1596 |
| |
| |||
1610 | 1610 |
| |
1611 | 1611 |
| |
1612 | 1612 |
| |
1613 |
| - | |
1614 |
| - | |
| 1613 | + | |
| 1614 | + | |
1615 | 1615 |
| |
1616 | 1616 |
| |
1617 | 1617 |
| |
1618 | 1618 |
| |
1619 |
| - | |
| 1619 | + | |
1620 | 1620 |
| |
1621 | 1621 |
| |
1622 | 1622 |
| |
1623 |
| - | |
| 1623 | + | |
1624 | 1624 |
| |
1625 | 1625 |
| |
1626 | 1626 |
| |
| |||
1650 | 1650 |
| |
1651 | 1651 |
| |
1652 | 1652 |
| |
1653 |
| - | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
1654 | 1656 |
| |
1655 | 1657 |
| |
1656 | 1658 |
| |
1657 | 1659 |
| |
1658 | 1660 |
| |
1659 | 1661 |
| |
1660 |
| - | |
| 1662 | + | |
1661 | 1663 |
| |
1662 |
| - | |
| 1664 | + | |
1663 | 1665 |
| |
1664 | 1666 |
| |
1665 | 1667 |
| |
| 1668 | + | |
1666 | 1669 |
| |
1667 | 1670 |
| |
1668 | 1671 |
| |
| |||
1717 | 1720 |
| |
1718 | 1721 |
| |
1719 | 1722 |
| |
1720 |
| - | |
| 1723 | + | |
1721 | 1724 |
| |
1722 | 1725 |
| |
1723 | 1726 |
| |
| |||
1770 | 1773 |
| |
1771 | 1774 |
| |
1772 | 1775 |
| |
1773 |
| - | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
1774 | 1779 |
| |
1775 | 1780 |
| |
1776 | 1781 |
| |
1777 | 1782 |
| |
1778 | 1783 |
| |
1779 | 1784 |
| |
1780 |
| - | |
| 1785 | + | |
1781 | 1786 |
| |
1782 |
| - | |
| 1787 | + | |
1783 | 1788 |
| |
1784 | 1789 |
| |
1785 | 1790 |
| |
| 1791 | + | |
1786 | 1792 |
| |
1787 | 1793 |
| |
1788 | 1794 |
| |
|
Lines changed: 26 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1364 | 1364 |
| |
1365 | 1365 |
| |
1366 | 1366 |
| |
1367 |
| - | |
1368 |
| - | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
1369 | 1371 |
| |
1370 | 1372 |
| |
1371 | 1373 |
| |
1372 | 1374 |
| |
1373 |
| - | |
| 1375 | + | |
1374 | 1376 |
| |
1375 | 1377 |
| |
1376 | 1378 |
| |
| |||
1406 | 1408 |
| |
1407 | 1409 |
| |
1408 | 1410 |
| |
1409 |
| - | |
1410 |
| - | |
1411 |
| - | |
1412 |
| - | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
1413 | 1425 |
| |
1414 |
| - | |
1415 |
| - | |
| 1426 | + | |
| 1427 | + | |
1416 | 1428 |
| |
1417 | 1429 |
| |
1418 | 1430 |
| |
| |||
1513 | 1525 |
| |
1514 | 1526 |
| |
1515 | 1527 |
| |
1516 |
| - | |
1517 |
| - | |
1518 |
| - | |
1519 |
| - | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
1520 | 1532 |
| |
1521 |
| - | |
| 1533 | + | |
1522 | 1534 |
| |
1523 | 1535 |
| |
1524 | 1536 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1251 | 1251 |
| |
1252 | 1252 |
| |
1253 | 1253 |
| |
1254 |
| - | |
| 1254 | + | |
1255 | 1255 |
| |
1256 | 1256 |
| |
1257 | 1257 |
| |
|
0 commit comments
Comments
(0)