- Notifications
You must be signed in to change notification settings - Fork4.9k
Commite0b1ee1
committed
Skip checking of scan keys required for directional scan in B-tree
Currently, B-tree code matches every scan key to every item on the page.Imagine the ordered B-tree scan for the query like this.SELECT * FROM tbl WHERE col > 'a' AND col < 'b' ORDER BY col;The (col > 'a') scan key will be always matched once we find the location tostart the scan. The (col < 'b') scan key will match every item on the pageas long as it matches the last item on the page.This patch implements prechecking of the scan keys required for directionalscan on beginning of page scan. If precheck is successful we can skip thisscan keys check for the items on the page. That could lead to significantacceleration especially if the comparison operator is expensive.Idea from patch by Konstantin Knizhnik.Discussion:https://postgr.es/m/079c3f8e-3371-abe2-e93c-fc8a0ae3f571%40garret.ruReviewed-by: Peter Geoghegan, Pavel Borisov1 parent5da0a62 commite0b1ee1
File tree
4 files changed
+119
-17
lines changed- src
- backend/access/nbtree
- include/access
4 files changed
+119
-17
lines changedLines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
407 | 407 |
| |
408 | 408 |
| |
409 | 409 |
| |
| 410 | + | |
410 | 411 |
| |
411 | 412 |
| |
412 | 413 |
| |
|
Lines changed: 67 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1429 | 1429 |
| |
1430 | 1430 |
| |
1431 | 1431 |
| |
| 1432 | + | |
1432 | 1433 |
| |
1433 | 1434 |
| |
1434 | 1435 |
| |
| |||
1539 | 1540 |
| |
1540 | 1541 |
| |
1541 | 1542 |
| |
| 1543 | + | |
1542 | 1544 |
| |
1543 | 1545 |
| |
1544 | 1546 |
| |
| |||
1592 | 1594 |
| |
1593 | 1595 |
| |
1594 | 1596 |
| |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
1595 | 1637 |
| |
1596 | 1638 |
| |
1597 | 1639 |
| |
| |||
1603 | 1645 |
| |
1604 | 1646 |
| |
1605 | 1647 |
| |
| 1648 | + | |
1606 | 1649 |
| |
1607 | 1650 |
| |
1608 | 1651 |
| |
| |||
1616 | 1659 |
| |
1617 | 1660 |
| |
1618 | 1661 |
| |
1619 |
| - | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
1620 | 1674 |
| |
1621 | 1675 |
| |
1622 | 1676 |
| |
| |||
1673 | 1727 |
| |
1674 | 1728 |
| |
1675 | 1729 |
| |
1676 |
| - | |
| 1730 | + | |
1677 | 1731 |
| |
1678 | 1732 |
| |
1679 | 1733 |
| |
| |||
1725 | 1779 |
| |
1726 | 1780 |
| |
1727 | 1781 |
| |
1728 |
| - | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
1729 | 1792 |
| |
1730 | 1793 |
| |
1731 | 1794 |
| |
| |||
2443 | 2506 |
| |
2444 | 2507 |
| |
2445 | 2508 |
| |
| 2509 | + | |
2446 | 2510 |
| |
2447 | 2511 |
| |
2448 | 2512 |
| |
|
Lines changed: 46 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1372 | 1372 |
| |
1373 | 1373 |
| |
1374 | 1374 |
| |
| 1375 | + | |
| 1376 | + | |
1375 | 1377 |
| |
1376 | 1378 |
| |
1377 | 1379 |
| |
1378 |
| - | |
| 1380 | + | |
| 1381 | + | |
1379 | 1382 |
| |
1380 | 1383 |
| |
1381 | 1384 |
| |
| |||
1396 | 1399 |
| |
1397 | 1400 |
| |
1398 | 1401 |
| |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
1399 | 1425 |
| |
1400 | 1426 |
| |
1401 | 1427 |
| |
| |||
1444 | 1470 |
| |
1445 | 1471 |
| |
1446 | 1472 |
| |
1447 |
| - | |
1448 |
| - | |
1449 |
| - | |
1450 |
| - | |
1451 |
| - | |
| 1473 | + | |
1452 | 1474 |
| |
1453 | 1475 |
| |
1454 | 1476 |
| |
| |||
1498 | 1520 |
| |
1499 | 1521 |
| |
1500 | 1522 |
| |
1501 |
| - | |
1502 |
| - | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
1503 | 1540 |
| |
1504 | 1541 |
| |
1505 | 1542 |
| |
| |||
1513 | 1550 |
| |
1514 | 1551 |
| |
1515 | 1552 |
| |
1516 |
| - | |
1517 |
| - | |
1518 |
| - | |
1519 |
| - | |
1520 |
| - | |
| 1553 | + | |
1521 | 1554 |
| |
1522 | 1555 |
| |
1523 | 1556 |
| |
|
Lines changed: 5 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1056 | 1056 |
| |
1057 | 1057 |
| |
1058 | 1058 |
| |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
1059 | 1062 |
| |
1060 | 1063 |
| |
1061 | 1064 |
| |
| |||
1255 | 1258 |
| |
1256 | 1259 |
| |
1257 | 1260 |
| |
1258 |
| - | |
| 1261 | + | |
| 1262 | + | |
1259 | 1263 |
| |
1260 | 1264 |
| |
1261 | 1265 |
| |
|
0 commit comments
Comments
(0)