diff options
author | Igor Babaev <igor@askmonty.org> | 2019-02-03 14:56:12 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2019-02-03 14:56:12 -0800 |
commit | 658128af43b4d7c6db445164f8ed25ed4d1e3109 (patch) | |
tree | 7a71580cca55759b8bb2730e117436478948d77f /mysql-test/main/func_group.test | |
parent | 5f46670bd09babbee75a24ac82eb4ade0706da66 (diff) | |
download | mariadb-git-658128af43b4d7c6db445164f8ed25ed4d1e3109.tar.gz |
MDEV-16188 Use in-memory PK filters built from range index scans
This patch contains a full implementation of the optimization
that allows to use in-memory rowid / primary filters built for range
conditions over indexes. In many cases usage of such filters reduce
the number of disk seeks spent for fetching table rows.
In this implementation the choice of what possible filter to be applied
(if any) is made purely on cost-based considerations.
This implementation re-achitectured the partial implementation of
the feature pushed by Galina Shalygina in the commit
8d5a11122c32f4d9eb87536886c6e893377bdd07.
Besides this patch contains a better implementation of the generic
handler function handler::multi_range_read_info_const() that
takes into account gaps between ranges when calculating the cost of
range index scans. It also contains some corrections of the
implementation of the handler function records_in_range() for MyISAM.
This patch supports the feature for InnoDB and MyISAM.
Diffstat (limited to 'mysql-test/main/func_group.test')
-rw-r--r-- | mysql-test/main/func_group.test | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/mysql-test/main/func_group.test b/mysql-test/main/func_group.test index d847f7cd5f7..bc2d6e9047d 100644 --- a/mysql-test/main/func_group.test +++ b/mysql-test/main/func_group.test @@ -363,7 +363,7 @@ select min(a1) from t1 where a1 != 'KKK'; explain select max(a3) from t1 where a2 < 2 and a3 < 'SEA'; explain -select max(t1.a3), min(t2.a2) from t1, t2 where t1.a2 = 2 and t1.a3 < 'MIN' and t2.a3 > 'CA'; +select max(t1.a3), min(t2.a2) from t1, t2 where t1.a2 = 2 and t1.a3 < 'DEN' and t2.a3 >= 'LA'; explain select min(a4 - 0.01) from t1; @@ -849,7 +849,8 @@ EXPLAIN SELECT MIN(a), MIN(b) FROM t1; SELECT MIN(a), MIN(b) FROM t1; CREATE TABLE t2( a INT, b INT, c INT, KEY(a, b) ); -INSERT INTO t2 ( a, b, c ) VALUES ( 1, NULL, 2 ), ( 1, 3, 4 ), ( 1, 4, 4 ); +INSERT INTO t2 ( a, b, c ) VALUES + ( 1, NULL, 2 ), ( 1, 3, 4 ), ( 1, 4, 4 ), ( 2, NULL, 2 ), ( 2, 3, 4 ), ( 2, 4, 4 ); EXPLAIN SELECT MIN(b), MIN(c) FROM t2 WHERE a = 1; SELECT MIN(b), MIN(c) FROM t2 WHERE a = 1; @@ -1168,14 +1169,14 @@ drop table t1; --echo # CREATE TABLE t1 (a int NOT NULL, KEY(a)); -INSERT INTO t1 VALUES (10), (8), (11), (7), (15), (12), (9); +INSERT INTO t1 VALUES (10), (8), (11), (7), (15), (12), (9), (13), (15), (17); CREATE TABLE t2 (a int, b int); INSERT INTO t2 VALUES (8,2), (6,9), (8,4), (5,3), (9,1); EXPLAIN EXTENDED -SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT 3,4) AND a<10; +SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT 3,4) AND a<8; SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT 3,4) AND a<10; EXPLAIN EXTENDED |