You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MDEV-34413 Index Condition Pushdown for reverse ordered scans
Allows index condition pushdown for reverse ordered scans, a previously disabled feature due to poor performance. This patch adds a new API to the handler class called set_end_range which allows callers to tell the handler what the end of the index range will be when scanning. Combined with a pushed index condition, the handler can scan the index efficiently and not read beyond the end of the given range. When checking if the pushed index condition matches, the handler will also check if scanning has reached the end of the provided range and stop if so. If we instead only enabled ICP for reverse ordered scans without also calling this new API, then the handler would perform unnecessary index condition checks. In fact this would continue until the end of the index is reached. These changes are agnostic of storage engine. That is, any storage engine that supports index condition pushdown will inhereit this new behavior as it is implemented in the SQL and storage engine API layers. The partitioned tables storage meta-engine (ha_partition) adds an override of set_end_range which recursively calls set_end_range on its child storage engine (handler) implementations. This commit updates the test made in an earlier commit to show that ICP matches happen for the reverse ordered case. This patch is based on changes written by Olav Sandstaa in MySQL commit da1d92fd46071cd86de61058b6ea39fd9affcd87
Copy file name to clipboardExpand all lines: mysql-test/main/myisam_explain_non_select_all.result
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1779,7 +1779,7 @@ FLUSH STATUS;
1779
1779
FLUSH TABLES;
1780
1780
EXPLAIN EXTENDED SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5;
1781
1781
id select_type table type possible_keys key key_len ref rows filtered Extra
1782
-
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 8 100.00 Using where
1782
+
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 8 100.00 Using index condition
1783
1783
Warnings:
1784
1784
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` desc limit 5
1785
1785
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
@@ -2291,7 +2291,7 @@ FLUSH STATUS;
2291
2291
FLUSH TABLES;
2292
2292
EXPLAIN EXTENDED SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5;
2293
2293
id select_type table type possible_keys key key_len ref rows filtered Extra
2294
-
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 8 100.00 Using where
2294
+
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 8 100.00 Using index condition
2295
2295
Warnings:
2296
2296
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` desc limit 5
2297
2297
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
0 commit comments