Commit da1d92f
Olav Sandstaa
Fix for Bug#14503142 PERFORMANCE REGRESSION FOR DESCENDING RANGE SCAN WHEN
USING ICP
The performance regression is caused by use of ICP in combination with
a descending range scan that is using QUICK_SELECT_DESC. The
QUICK_SELECT_DESC object executes the range scan by reading the index
using ha_index_prev() and then evaluating if the record is within the
current range. This works fine when we have not pushed any index
condition to the storage engine since every record will be returned
and evaluated by QUICK_SELECT_DESC.get_next(). When ICP is used, the
call to ha_index_prev() will only return records that do not get
filtered by the pushed index condition. In this case, as soon as
QUICK_SELECT_DESC.get_next() tries to read the first record that is
outside the current range, the ICP implementation in the storage
engine will filter it away and continue reading from the index without
finding any qualifying records. It will continue reading from the
index until it has read to the end of the index. The increased
execution time is caused by the ICP implementation reading to the
end of the index instead of stopping when it has reached the end of
the current range.
This patch solves this problem by adding a new handler call
handler::set_end_range() which informs the storage engine about the
end of the current index scan. The ICP implementation in the storage
engine will use this information and check that the next record is
within this range. For each range that QUICK_SELECT_DESC.get_next()
needs to read, it will use this call to let the storage engine know
about the end of the range.1 parent aa9add5 commit da1d92f
File tree
6 files changed
+93
-16
lines changed- sql
- storage
- innobase/handler
- myisam
6 files changed
+93
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5390 | 5390 | | |
5391 | 5391 | | |
5392 | 5392 | | |
| 5393 | + | |
5393 | 5394 | | |
5394 | 5395 | | |
5395 | 5396 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6550 | 6550 | | |
6551 | 6551 | | |
6552 | 6552 | | |
| 6553 | + | |
6553 | 6554 | | |
6554 | 6555 | | |
6555 | 6556 | | |
| |||
6626 | 6627 | | |
6627 | 6628 | | |
6628 | 6629 | | |
| 6630 | + | |
| 6631 | + | |
| 6632 | + | |
| 6633 | + | |
| 6634 | + | |
| 6635 | + | |
| 6636 | + | |
| 6637 | + | |
| 6638 | + | |
| 6639 | + | |
| 6640 | + | |
| 6641 | + | |
| 6642 | + | |
| 6643 | + | |
6629 | 6644 | | |
6630 | 6645 | | |
6631 | 6646 | | |
| |||
6654 | 6669 | | |
6655 | 6670 | | |
6656 | 6671 | | |
6657 | | - | |
6658 | | - | |
| 6672 | + | |
| 6673 | + | |
| 6674 | + | |
| 6675 | + | |
| 6676 | + | |
| 6677 | + | |
| 6678 | + | |
| 6679 | + | |
| 6680 | + | |
| 6681 | + | |
| 6682 | + | |
| 6683 | + | |
| 6684 | + | |
| 6685 | + | |
| 6686 | + | |
| 6687 | + | |
| 6688 | + | |
6659 | 6689 | | |
6660 | 6690 | | |
6661 | | - | |
| 6691 | + | |
6662 | 6692 | | |
6663 | 6693 | | |
6664 | 6694 | | |
6665 | 6695 | | |
6666 | 6696 | | |
6667 | 6697 | | |
6668 | 6698 | | |
| 6699 | + | |
| 6700 | + | |
6669 | 6701 | | |
6670 | 6702 | | |
6671 | 6703 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1778 | 1778 | | |
1779 | 1779 | | |
1780 | 1780 | | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
1781 | 1795 | | |
1782 | 1796 | | |
1783 | 1797 | | |
| |||
1863 | 1877 | | |
1864 | 1878 | | |
1865 | 1879 | | |
1866 | | - | |
| 1880 | + | |
| 1881 | + | |
1867 | 1882 | | |
1868 | 1883 | | |
1869 | 1884 | | |
| |||
2203 | 2218 | | |
2204 | 2219 | | |
2205 | 2220 | | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
2206 | 2232 | | |
2207 | | - | |
| 2233 | + | |
2208 | 2234 | | |
2209 | 2235 | | |
2210 | 2236 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10441 | 10441 | | |
10442 | 10442 | | |
10443 | 10443 | | |
10444 | | - | |
10445 | | - | |
10446 | | - | |
| 10444 | + | |
| 10445 | + | |
| 10446 | + | |
| 10447 | + | |
| 10448 | + | |
10447 | 10449 | | |
10448 | 10450 | | |
10449 | 10451 | | |
| |||
10472 | 10474 | | |
10473 | 10475 | | |
10474 | 10476 | | |
| 10477 | + | |
| 10478 | + | |
| 10479 | + | |
| 10480 | + | |
| 10481 | + | |
| 10482 | + | |
| 10483 | + | |
| 10484 | + | |
| 10485 | + | |
| 10486 | + | |
| 10487 | + | |
| 10488 | + | |
| 10489 | + | |
| 10490 | + | |
| 10491 | + | |
| 10492 | + | |
| 10493 | + | |
| 10494 | + | |
10475 | 10495 | | |
10476 | 10496 | | |
10477 | 10497 | | |
| |||
10483 | 10503 | | |
10484 | 10504 | | |
10485 | 10505 | | |
10486 | | - | |
10487 | | - | |
| 10506 | + | |
10488 | 10507 | | |
10489 | 10508 | | |
10490 | 10509 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16332 | 16332 | | |
16333 | 16333 | | |
16334 | 16334 | | |
16335 | | - | |
| 16335 | + | |
16336 | 16336 | | |
16337 | 16337 | | |
16338 | 16338 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1605 | 1605 | | |
1606 | 1606 | | |
1607 | 1607 | | |
1608 | | - | |
1609 | | - | |
1610 | | - | |
1611 | | - | |
1612 | | - | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
1613 | 1612 | | |
1614 | 1613 | | |
1615 | 1614 | | |
| |||
0 commit comments