diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2009-12-15 20:23:55 +0300 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2009-12-15 20:23:55 +0300 |
commit | 59b64720102f8f4f43c856f1e9c2ba2007156b18 (patch) | |
tree | 16ea30fc86361b17dd05766e4aaf9b4b12275c09 | |
parent | 2a496c4dcfaa715588fa48009b7779d38b1a137a (diff) | |
download | mariadb-git-59b64720102f8f4f43c856f1e9c2ba2007156b18.tar.gz |
Backport into MariaDB-5.2 the following:
WL#2474 "Multi Range Read: Change the default MRR implementation to implement new MRR interface"
WL#2475 "Batched range read functions for MyISAM/InnoDb"
"Index condition pushdown for MyISAM/InnoDB"
- Adjust test results (checked)
- Code cleanup.
-rw-r--r-- | mysql-test/r/myisam_mrr.result | 3 | ||||
-rw-r--r-- | mysql-test/suite/maria/r/maria.result | 12 | ||||
-rw-r--r-- | mysql-test/suite/parts/r/partition_special_innodb.result | 12 | ||||
-rw-r--r-- | mysql-test/suite/parts/r/partition_special_myisam.result | 8 | ||||
-rw-r--r-- | mysql-test/suite/pbxt/r/distinct.result | 4 | ||||
-rw-r--r-- | mysql-test/suite/pbxt/r/explain.result | 2 | ||||
-rw-r--r-- | mysql-test/suite/pbxt/r/heap.result | 2 | ||||
-rw-r--r-- | mysql-test/suite/pbxt/r/join.result | 2 | ||||
-rw-r--r-- | mysql-test/suite/pbxt/r/join_nested.result | 38 | ||||
-rw-r--r-- | mysql-test/suite/pbxt/r/key_cache.result | 2 | ||||
-rw-r--r-- | mysql-test/suite/pbxt/r/negation_elimination.result | 2 | ||||
-rw-r--r-- | mysql-test/suite/pbxt/r/null.result | 2 | ||||
-rw-r--r-- | mysql-test/suite/pbxt/r/null_key.result | 16 | ||||
-rw-r--r-- | mysql-test/t/myisam_mrr.test | 1 | ||||
-rw-r--r-- | sql/ds_mrr.cc | 16 | ||||
-rw-r--r-- | sql/ds_mrr.h | 7 | ||||
-rw-r--r-- | sql/ha_ndbcluster.cc | 3 | ||||
-rw-r--r-- | sql/ha_ndbcluster.h | 10 | ||||
-rw-r--r-- | sql/handler.cc | 130 | ||||
-rw-r--r-- | sql/handler.h | 18 | ||||
-rw-r--r-- | sql/sql_select.cc | 7 | ||||
-rw-r--r-- | sql/sql_select.h | 3 |
22 files changed, 86 insertions, 214 deletions
diff --git a/mysql-test/r/myisam_mrr.result b/mysql-test/r/myisam_mrr.result index f3f89966da2..e61d5484e27 100644 --- a/mysql-test/r/myisam_mrr.result +++ b/mysql-test/r/myisam_mrr.result @@ -3,9 +3,6 @@ set @read_rnd_buffer_size_save= @@read_rnd_buffer_size; set read_rnd_buffer_size=79; Warnings: Warning 1292 Truncated incorrect read_rnd_buffer_size value: '79' -select @@read_rnd_buffer_size; -@@read_rnd_buffer_size -8228 create table t1(a int); show create table t1; Table Create Table diff --git a/mysql-test/suite/maria/r/maria.result b/mysql-test/suite/maria/r/maria.result index 5e33c3fa423..49f3bbcd07a 100644 --- a/mysql-test/suite/maria/r/maria.result +++ b/mysql-test/suite/maria/r/maria.result @@ -382,20 +382,20 @@ id select_type table type possible_keys key key_len ref rows Extra explain select * from t1,t2 where t1.b=t2.b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL b NULL NULL NULL 2 -1 SIMPLE t1 ref b b 5 test.t2.b 1 Using where +1 SIMPLE t1 ref b b 5 test.t2.b 1 explain select * from t1,t2 force index(c) where t1.a=t2.a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 1 SIMPLE t1 ref a a 4 test.t2.a 3 explain select * from t1 where a=0 or a=2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 4 NULL 4 Using where +1 SIMPLE t1 range a a 4 NULL 4 Using index condition; Using MRR explain select * from t1 force index (a) where a=0 or a=2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 4 NULL 4 Using where +1 SIMPLE t1 range a a 4 NULL 4 Using index condition; Using MRR explain select * from t1 where c=1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c,c_2 c 5 const 1 Using where +1 SIMPLE t1 ref c,c_2 c 5 const 1 explain select * from t1 use index() where c=1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where @@ -1131,7 +1131,7 @@ qq *a *a*a * explain select * from t1 where v='a'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v,v_2 # 13 const # Using where +1 SIMPLE t1 ref v,v_2 # 13 const # Using index condition select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -1307,7 +1307,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref v v 303 const # Using where; Using index explain select * from t1 where v='a'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # Using where +1 SIMPLE t1 ref v v 303 const # Using index condition select v,count(*) from t1 group by v limit 10; v count(*) a 1 diff --git a/mysql-test/suite/parts/r/partition_special_innodb.result b/mysql-test/suite/parts/r/partition_special_innodb.result index e73dd6609dc..64a18188888 100644 --- a/mysql-test/suite/parts/r/partition_special_innodb.result +++ b/mysql-test/suite/parts/r/partition_special_innodb.result @@ -31,9 +31,9 @@ a b c d 2000-06-15 jukg zikhuk m select * from t1 where a<19851231; a b c d -1983-12-31 cdef srtbvsr w -1980-10-14 fgbbd dtzndtz w 1975-01-01 abcde abcde m +1980-10-14 fgbbd dtzndtz w +1983-12-31 cdef srtbvsr w drop table t1; create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h)) engine='InnoDB' partition by key(a,b,c,d,e,f,g,h) ( @@ -73,9 +73,9 @@ a b c d e f g h i 2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 pib mdotkbm.m select * from t1 where a<19851231; a b c d e f g h i +1975-01-01 abcde abcde m 1234 123.45 32412341234 113 tbhth nrzh ztfghgfh fzh ftzhj fztjh 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 d,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 liuugbzvdmrlti b itiortudirtfgtibm dfi -1975-01-01 abcde abcde m 1234 123.45 32412341234 113 tbhth nrzh ztfghgfh fzh ftzhj fztjh drop table t1; create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1)) engine='InnoDB' partition by key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1) ( @@ -123,9 +123,9 @@ a b c d e f g h a1 b1 c1 d1 e1 f1 g1 h1 i 2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 pib mdotkbm.m select * from t1 where a<19851231; a b c d e f g h a1 b1 c1 d1 e1 f1 g1 h1 i -1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 liuugbzvdmrlti b itiortudirtfgtibm dfi -1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 d,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 tbhth nrzh ztfghgfh fzh ftzhj fztjh +1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 d,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr +1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 liuugbzvdmrlti b itiortudirtfgtibm dfi drop table t1; create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, a2 date not null, b2 varchar(50) not null, c2 varchar(50) not null, d2 enum('m', 'w') not null, e2 int not null, f2 decimal (18,2) not null, g2 bigint not null, h2 tinyint not null, a3 date not null, b3 varchar(50) not null, c3 varchar(50) not null, d3 enum('m', 'w') not null, e3 int not null, f3 decimal (18,2) not null, g3 bigint not null, h3 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,f3,g3,h3,a4)) engine='InnoDB' partition by key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,f3,g3,h3,a4) ( @@ -203,9 +203,9 @@ a b c d e f g h a1 b1 c1 d1 e1 f1 g1 h1 a2 b2 c2 d2 e2 f2 g2 h2 a3 b3 c3 d3 e3 f 2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 pib mdotkbm.m select * from t1 where a<19851231; a b c d e f g h a1 b1 c1 d1 e1 f1 g1 h1 a2 b2 c2 d2 e2 f2 g2 h2 a3 b3 c3 d3 e3 f3 g3 h3 i +1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 tbhth nrzh ztfghgfh fzh ftzhj fztjh 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 d,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 liuugbzvdmrlti b itiortudirtfgtibm dfi -1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 tbhth nrzh ztfghgfh fzh ftzhj fztjh drop table t1; # Bug#34604 - Assertion 'inited==RND' failed in handler::ha_rnd_end CREATE TABLE t1 ( diff --git a/mysql-test/suite/parts/r/partition_special_myisam.result b/mysql-test/suite/parts/r/partition_special_myisam.result index ca7f7aeb760..613f0716de4 100644 --- a/mysql-test/suite/parts/r/partition_special_myisam.result +++ b/mysql-test/suite/parts/r/partition_special_myisam.result @@ -73,9 +73,9 @@ a b c d e f g h i 2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 pib mdotkbm.m select * from t1 where a<19851231; a b c d e f g h i +1975-01-01 abcde abcde m 1234 123.45 32412341234 113 tbhth nrzh ztfghgfh fzh ftzhj fztjh 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 d,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 liuugbzvdmrlti b itiortudirtfgtibm dfi -1975-01-01 abcde abcde m 1234 123.45 32412341234 113 tbhth nrzh ztfghgfh fzh ftzhj fztjh drop table t1; create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1)) engine='MyISAM' partition by key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1) ( @@ -123,9 +123,9 @@ a b c d e f g h a1 b1 c1 d1 e1 f1 g1 h1 i 2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 pib mdotkbm.m select * from t1 where a<19851231; a b c d e f g h a1 b1 c1 d1 e1 f1 g1 h1 i -1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 liuugbzvdmrlti b itiortudirtfgtibm dfi -1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 d,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 tbhth nrzh ztfghgfh fzh ftzhj fztjh +1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 d,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr +1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 liuugbzvdmrlti b itiortudirtfgtibm dfi drop table t1; create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, a2 date not null, b2 varchar(50) not null, c2 varchar(50) not null, d2 enum('m', 'w') not null, e2 int not null, f2 decimal (18,2) not null, g2 bigint not null, h2 tinyint not null, a3 date not null, b3 varchar(50) not null, c3 varchar(50) not null, d3 enum('m', 'w') not null, e3 int not null, f3 decimal (18,2) not null, g3 bigint not null, h3 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,f3,g3,h3,a4)) engine='MyISAM' partition by key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,f3,g3,h3,a4) ( @@ -203,7 +203,7 @@ a b c d e f g h a1 b1 c1 d1 e1 f1 g1 h1 a2 b2 c2 d2 e2 f2 g2 h2 a3 b3 c3 d3 e3 f 2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 pib mdotkbm.m select * from t1 where a<19851231; a b c d e f g h a1 b1 c1 d1 e1 f1 g1 h1 a2 b2 c2 d2 e2 f2 g2 h2 a3 b3 c3 d3 e3 f3 g3 h3 i +1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 tbhth nrzh ztfghgfh fzh ftzhj fztjh 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 d,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 liuugbzvdmrlti b itiortudirtfgtibm dfi -1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 tbhth nrzh ztfghgfh fzh ftzhj fztjh drop table t1; diff --git a/mysql-test/suite/pbxt/r/distinct.result b/mysql-test/suite/pbxt/r/distinct.result index c3e8342a6e1..d95a2bb3232 100644 --- a/mysql-test/suite/pbxt/r/distinct.result +++ b/mysql-test/suite/pbxt/r/distinct.result @@ -175,7 +175,7 @@ explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 4 Using temporary 1 SIMPLE t2 ref a a 4 test.t1.a 1 Using index -1 SIMPLE t3 ref a a 5 test.t1.b 1 Using where; Using index +1 SIMPLE t3 ref a a 5 test.t1.b 1 Using index SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a; a 1 @@ -190,7 +190,7 @@ insert into t3 select * from t4; explain select distinct t1.a from t1,t3 where t1.a=t3.a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary -1 SIMPLE t3 ref a a 5 test.t1.a 1 Using where; Using index; Distinct +1 SIMPLE t3 ref a a 5 test.t1.a 1 Using index; Distinct select distinct t1.a from t1,t3 where t1.a=t3.a; a 1 diff --git a/mysql-test/suite/pbxt/r/explain.result b/mysql-test/suite/pbxt/r/explain.result index a9907aa33fe..cd9b1149c1d 100644 --- a/mysql-test/suite/pbxt/r/explain.result +++ b/mysql-test/suite/pbxt/r/explain.result @@ -50,7 +50,7 @@ insert into ÔÁ (ËÏÌ0) values (1); insert into ÔÁ (ËÏÌ0) values (2); explain select ËÏÌ0 from ÔÁ where ËÏÌ0=1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE ÔÁ ref ÉÎÄ0,ÉÎÄ01 ÉÎÄ0 5 const 1 Using where; Using index +1 SIMPLE ÔÁ ref ÉÎÄ0,ÉÎÄ01 ÉÎÄ0 5 const 1 Using index drop table ÔÁÂ; set names latin1; select 3 into @v1; diff --git a/mysql-test/suite/pbxt/r/heap.result b/mysql-test/suite/pbxt/r/heap.result index 57109f0d4c8..366258882ad 100644 --- a/mysql-test/suite/pbxt/r/heap.result +++ b/mysql-test/suite/pbxt/r/heap.result @@ -204,7 +204,7 @@ key a (a) INSERT INTO t1 VALUES (10), (10), (10); EXPLAIN SELECT * FROM t1 WHERE a=10; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 3 Using where +1 SIMPLE t1 ref a a 5 const 3 SELECT * FROM t1 WHERE a=10; a 10 diff --git a/mysql-test/suite/pbxt/r/join.result b/mysql-test/suite/pbxt/r/join.result index a74ee3d3b35..6b6dba69b32 100644 --- a/mysql-test/suite/pbxt/r/join.result +++ b/mysql-test/suite/pbxt/r/join.result @@ -774,7 +774,7 @@ insert into t3 select * from t2 where a < 800; explain select * from t2,t3 where t2.a < 200 and t2.b=t3.b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range a,b a 5 NULL 1 Using where -1 SIMPLE t3 ref b b 5 test.t2.b 1 Using where +1 SIMPLE t3 ref b b 5 test.t2.b 1 drop table t1, t2, t3; create table t1 (a int); insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); diff --git a/mysql-test/suite/pbxt/r/join_nested.result b/mysql-test/suite/pbxt/r/join_nested.result index 92dc4f8acf2..370316465de 100644 --- a/mysql-test/suite/pbxt/r/join_nested.result +++ b/mysql-test/suite/pbxt/r/join_nested.result @@ -74,7 +74,7 @@ WHERE t3.a=1 OR t3.c IS NULL; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on((`test`.`t4`.`b` = `test`.`t2`.`b`)) where ((`test`.`t3`.`a` = 1) or isnull(`test`.`t3`.`c`)) SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b @@ -150,7 +150,7 @@ WHERE t3.a>1 OR t3.c IS NULL; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on((`test`.`t4`.`b` = `test`.`t2`.`b`)) where ((`test`.`t3`.`a` > 1) or isnull(`test`.`t3`.`c`)) @@ -180,7 +180,7 @@ WHERE (t3.a>1 OR t3.c IS NULL) AND id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on((`test`.`t4`.`b` = `test`.`t2`.`b`)) where (((`test`.`t3`.`a` > 1) or isnull(`test`.`t3`.`c`)) and ((`test`.`t5`.`a` < 3) or isnull(`test`.`t5`.`c`))) @@ -230,7 +230,7 @@ ON t7.b=t8.b AND t6.b < 10; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using join buffer -1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t7`.`b` = `test`.`t8`.`b`) and (`test`.`t6`.`b` < 10))) where 1 SELECT t6.a,t6.b,t7.a,t7.b,t8.a,t8.b @@ -546,12 +546,12 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) where ((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`))) SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b, @@ -837,8 +837,8 @@ WHERE t1.a <= 2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t1` join `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) where (`test`.`t1`.`a` <= 2) CREATE INDEX idx_b ON t2(b); @@ -851,7 +851,7 @@ ON t3.a=1 AND t3.b=t2.b AND t2.b=t4.b; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using join buffer -1 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 1 100.00 +1 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 1 100.00 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(((`test`.`t3`.`a` = 1) and (`test`.`t3`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` = `test`.`t4`.`b`))) where 1 @@ -1054,8 +1054,8 @@ t0.b=t1.b AND (t8.b=t9.b OR t8.c IS NULL) AND (t9.a=1); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t0 ref idx_a idx_a 5 const 1 100.00 Using where -1 SIMPLE t1 ref idx_b idx_b 5 test.t0.b 1 100.00 Using where +1 SIMPLE t0 ref idx_a idx_a 5 const 1 100.00 +1 SIMPLE t1 ref idx_b idx_b 5 test.t0.b 1 100.00 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00 @@ -1202,13 +1202,13 @@ test.t3 analyze status OK EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON c < 3 and b = c; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL a 5 NULL 21 Using index -1 SIMPLE t3 index c c 5 NULL 6 Using index +1 SIMPLE t3 index c c 5 NULL 6 Using where; Using index 1 SIMPLE t2 ref b b 5 test.t3.c 1 Using index EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL a 5 NULL # Using index 1 SIMPLE t3 index c c 5 NULL # Using index -1 SIMPLE t2 ref b b 5 test.t3.c # Using index +1 SIMPLE t2 ref b b 5 test.t3.c # Using where; Using index SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; a b c NULL 0 0 @@ -1279,7 +1279,7 @@ EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL a 5 NULL # Using index 1 SIMPLE t3 index c c 5 NULL # Using index -1 SIMPLE t2 ref b b 5 test.t3.c # Using index +1 SIMPLE t2 ref b b 5 test.t3.c # Using where; Using index SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; a b c NULL NULL NULL @@ -1323,8 +1323,8 @@ c11 c21 c31 EXPLAIN SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL NULL NULL NULL NULL 0 -1 SIMPLE t3 ALL NULL NULL NULL NULL 0 +1 SIMPLE t2 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE t3 ALL NULL NULL NULL NULL 0 Using where DROP TABLE t1,t2,t3; CREATE TABLE t1 (goods int(12) NOT NULL, price varchar(128) NOT NULL); INSERT INTO t1 VALUES (23, 2340), (26, 9900); diff --git a/mysql-test/suite/pbxt/r/key_cache.result b/mysql-test/suite/pbxt/r/key_cache.result index 5ff41bd29d7..703389ac763 100644 --- a/mysql-test/suite/pbxt/r/key_cache.result +++ b/mysql-test/suite/pbxt/r/key_cache.result @@ -122,7 +122,7 @@ i explain select count(*) from t1, t2 where t1.p = t2.i; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 2 Using index -1 SIMPLE t2 ref k1 k1 5 test.t1.p 1 Using where; Using index +1 SIMPLE t2 ref k1 k1 5 test.t1.p 1 Using index select count(*) from t1, t2 where t1.p = t2.i; count(*) 3 diff --git a/mysql-test/suite/pbxt/r/negation_elimination.result b/mysql-test/suite/pbxt/r/negation_elimination.result index f8a6b0f764d..74fb4579806 100644 --- a/mysql-test/suite/pbxt/r/negation_elimination.result +++ b/mysql-test/suite/pbxt/r/negation_elimination.result @@ -79,7 +79,7 @@ a 19 explain select * from t1 where not(a != 10); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 1 Using where; Using index +1 SIMPLE t1 ref a a 5 const 1 Using index select * from t1 where not(a != 1); a 1 diff --git a/mysql-test/suite/pbxt/r/null.result b/mysql-test/suite/pbxt/r/null.result index 036ba01ed1d..657022e6f2b 100644 --- a/mysql-test/suite/pbxt/r/null.result +++ b/mysql-test/suite/pbxt/r/null.result @@ -170,7 +170,7 @@ insert into t1 select i*2 from t1; insert into t1 values(null); explain select * from t1 where i=2 or i is null; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null i i 5 const # Using where; Using index +1 SIMPLE t1 ref_or_null i i 5 const # Using index select count(*) from t1 where i=2 or i is null; count(*) 10 diff --git a/mysql-test/suite/pbxt/r/null_key.result b/mysql-test/suite/pbxt/r/null_key.result index 753ebf31f1c..1d5dfa39761 100644 --- a/mysql-test/suite/pbxt/r/null_key.result +++ b/mysql-test/suite/pbxt/r/null_key.result @@ -21,10 +21,10 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range a,b a 9 NULL 3 Using where; Using index explain select * from t1 where (a is null or a = 7) and b=7; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null a,b a 9 const,const 2 Using where; Using index +1 SIMPLE t1 ref_or_null a,b a 9 const,const 2 Using index explain select * from t1 where (a is null or a = 7) and b=7 order by a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null a,b a 9 const,const 2 Using where; Using index; Using filesort +1 SIMPLE t1 ref_or_null a,b a 9 const,const 2 Using index; Using filesort explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref a,b a 5 const 3 Using where; Using index @@ -151,7 +151,7 @@ alter table t1 modify b int null; insert into t1 values (7,null), (8,null), (8,7); explain select * from t1 where a = 7 and (b=7 or b is null); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null a,b a 10 const,const 2 Using where; Using index +1 SIMPLE t1 ref_or_null a,b a 10 const,const 2 Using index select * from t1 where a = 7 and (b=7 or b is null); a b 7 7 @@ -166,7 +166,7 @@ a b NULL 7 explain select * from t1 where (a = 7 or a is null) and (a = 7 or a is null); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null a a 5 const 5 Using where; Using index +1 SIMPLE t1 ref_or_null a a 5 const 5 Using index select * from t1 where (a = 7 or a is null) and (a = 7 or a is null); a b 7 NULL @@ -192,7 +192,7 @@ a a b explain select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 -1 SIMPLE t1 ref_or_null a a 10 test.t2.a,const 4 Using where; Using index +1 SIMPLE t1 ref_or_null a a 10 test.t2.a,const 4 Using index select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null); a a b 7 7 7 @@ -202,7 +202,7 @@ a a b explain select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 -1 SIMPLE t1 ref_or_null a a 10 test.t2.a,const 4 Using where; Using index +1 SIMPLE t1 ref_or_null a a 10 test.t2.a,const 4 Using index select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7; a a b 7 7 7 @@ -226,7 +226,7 @@ delete from t1 where a=8; explain select * from t2,t1 where t1.a=t2.a or t1.a is null; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 4 -1 SIMPLE t1 ref_or_null a a 5 test.t2.a 4 Using where; Using index +1 SIMPLE t1 ref_or_null a a 5 test.t2.a 4 Using index explain select * from t2,t1 where t1.a<=>t2.a or (t1.a is null and t1.b <> 9); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 4 @@ -258,7 +258,7 @@ INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4 INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL); explain select id from t1 where uniq_id is null; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx1 idx1 5 const 5 Using where +1 SIMPLE t1 ref idx1 idx1 5 const 5 Using index condition explain select id from t1 where uniq_id =1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 const idx1 idx1 5 const 1 diff --git a/mysql-test/t/myisam_mrr.test b/mysql-test/t/myisam_mrr.test index 57616a8bc7c..25b0fc4af23 100644 --- a/mysql-test/t/myisam_mrr.test +++ b/mysql-test/t/myisam_mrr.test @@ -8,7 +8,6 @@ drop table if exists t1, t2, t3; set @read_rnd_buffer_size_save= @@read_rnd_buffer_size; set read_rnd_buffer_size=79; -select @@read_rnd_buffer_size; -- source include/mrr_tests.inc diff --git a/sql/ds_mrr.cc b/sql/ds_mrr.cc index 7a0fc65b8f5..0bf63e95a1f 100644 --- a/sql/ds_mrr.cc +++ b/sql/ds_mrr.cc @@ -950,8 +950,15 @@ void push_index_cond(JOIN_TAB *tab, uint keyno, bool other_tbls_ok) ((tab->table->file->index_flags(keyno, 0, 1) & HA_DO_INDEX_COND_PUSHDOWN) && tab->join->thd->variables.engine_condition_pushdown); - // psergey: - // + + /* + Do not try index condition pushdown on indexes which have partially-covered + columns. Unpacking from a column prefix into index tuple is not a supported + operation in some engines, see e.g. MySQL BUG#42991. + TODO: a better solution would be not to consider partially-covered columns + as parts of the index and still produce/check index condition for + fully-covered index columns. + */ KEY *key_info= tab->table->key_info + keyno; for (uint kp= 0; kp < key_info->key_parts; kp++) { @@ -961,7 +968,7 @@ void push_index_cond(JOIN_TAB *tab, uint keyno, bool other_tbls_ok) break; } } - // :psergey + /* When WL#5116 is done this DBUG statement must be removed. It's just a temporary hack to allow us to discriminate whether a test failure relates @@ -984,7 +991,8 @@ void push_index_cond(JOIN_TAB *tab, uint keyno, bool other_tbls_ok) Item *idx_remainder_cond= 0; tab->pre_idx_push_select_cond= tab->select_cond; #if 0 - // The following is only needed for BKA: + /* + psergey: enable the below when we backport BKA: */ /* For BKA cache we store condition to special BKA cache field because evaluation of the condition requires additional operations diff --git a/sql/ds_mrr.h b/sql/ds_mrr.h index 02abe72a4c1..12e2c955f0a 100644 --- a/sql/ds_mrr.h +++ b/sql/ds_mrr.h @@ -1,4 +1,8 @@ - +/* + This file contains declarations for + - Disk-Sweep MultiRangeRead (DS-MRR) implementation + - Index Condition Pushdown helper functions +*/ /** A Disk-Sweep MRR interface implementation @@ -65,4 +69,5 @@ private: uint *buffer_size, COST_VECT *cost); }; +void push_index_cond(JOIN_TAB *tab, uint keyno, bool other_tbls_ok); diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index c6b48c5b744..edfec934b2a 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -8702,6 +8702,8 @@ ha_ndbcluster::null_value_index_search(KEY_MULTI_RANGE *ranges, DBUG_RETURN(FALSE); } +#if 0 +/* MRR/NDB is disabled, for details see method declarations in ha_ndbcluster.h */ int ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p, KEY_MULTI_RANGE *ranges, @@ -9074,6 +9076,7 @@ found_next: m_multi_range_result_ptr += reclength; DBUG_RETURN(0); } +#endif int ha_ndbcluster::setup_recattr(const NdbRecAttr* curr) diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index f3651ebeca9..9e6d697492a 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -259,10 +259,20 @@ class ha_ndbcluster: public handler /** * Multi range stuff */ +#if 0 + /* + MRR/NDB is disabled in MariaDB. This is because in MariaDB, we've + backported + - the latest version of MRR interface (BKA needs this) + - the latest version of DS-MRR implementation + but didn't backport the latest version MRR/NDB implementation. + + */ int read_multi_range_first(KEY_MULTI_RANGE **found_range_p, KEY_MULTI_RANGE*ranges, uint range_count, bool sorted, HANDLER_BUFFER *buffer); int read_multi_range_next(KEY_MULTI_RANGE **found_range_p); +#endif bool null_value_index_search(KEY_MULTI_RANGE *ranges, KEY_MULTI_RANGE *end_range, HANDLER_BUFFER *buffer); diff --git a/sql/handler.cc b/sql/handler.cc index 3f4fec8f23a..fe3639a0e00 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -4193,136 +4193,6 @@ double handler::index_only_read_time(uint keynr, double records) return read_time; } -#if 0 -// psergey-mrr - -/** - Read the first row of a multi-range set. - - @param found_range_p Returns a pointer to the element in 'ranges' that - corresponds to the returned row. - @param ranges An array of KEY_MULTI_RANGE range descriptions. - @param range_count Number of ranges in 'ranges'. - @param sorted If result should be sorted per key. - @param buffer A HANDLER_BUFFER for internal handler usage. - - @note - - Record is read into table->record[0]. - - *found_range_p returns a valid value only if read_multi_range_first() - returns 0. - - Sorting is done within each range. If you want an overall sort, enter - 'ranges' with sorted ranges. - - @retval - 0 OK, found a row - @retval - HA_ERR_END_OF_FILE No rows in range - @retval - \# Error code -*/ -int handler::read_multi_range_first(KEY_MULTI_RANGE **found_range_p, - KEY_MULTI_RANGE *ranges, uint range_count, - bool sorted, HANDLER_BUFFER *buffer) -{ - int result= HA_ERR_END_OF_FILE; - DBUG_ENTER("handler::read_multi_range_first"); - multi_range_sorted= sorted; - multi_range_buffer= buffer; - - table->mark_columns_used_by_index_no_reset(active_index, table->read_set); - table->column_bitmaps_set(table->read_set, table->write_set); - - for (multi_range_curr= ranges, multi_range_end= ranges + range_count; - multi_range_curr < multi_range_end; - multi_range_curr++) - { - result= read_range_first(multi_range_curr->start_key.keypart_map ? - &multi_range_curr->start_key : 0, - multi_range_curr->end_key.keypart_map ? - &multi_range_curr->end_key : 0, - test(multi_range_curr->range_flag & EQ_RANGE), - multi_range_sorted); - if (result != HA_ERR_END_OF_FILE) - break; - } - - *found_range_p= multi_range_curr; - DBUG_PRINT("exit",("result %d", result)); - DBUG_RETURN(result); -} - - -/** - Read the next row of a multi-range set. - - @param found_range_p Returns a pointer to the element in 'ranges' that - corresponds to the returned row. - - @note - - Record is read into table->record[0]. - - *found_range_p returns a valid value only if read_multi_range_next() - returns 0. - - @retval - 0 OK, found a row - @retval - HA_ERR_END_OF_FILE No (more) rows in range - @retval - \# Error code -*/ -int handler::read_multi_range_next(KEY_MULTI_RANGE **found_range_p) -{ - int result; - DBUG_ENTER("handler::read_multi_range_next"); - - /* We should not be called after the last call returned EOF. */ - DBUG_ASSERT(multi_range_curr < multi_range_end); - - do - { - /* Save a call if there can be only one row in range. */ - if (multi_range_curr->range_flag != (UNIQUE_RANGE | EQ_RANGE)) - { - result= read_range_next(); - - /* On success or non-EOF errors jump to the end. */ - if (result != HA_ERR_END_OF_FILE) - break; - } - else - { - if (was_semi_consistent_read()) - goto scan_it_again; - /* - We need to set this for the last range only, but checking this - condition is more expensive than just setting the result code. - */ - result= HA_ERR_END_OF_FILE; - } - - multi_range_curr++; -scan_it_again: - /* Try the next range(s) until one matches a record. */ - for (; multi_range_curr < multi_range_end; multi_range_curr++) - { - result= read_range_first(multi_range_curr->start_key.keypart_map ? - &multi_range_curr->start_key : 0, - multi_range_curr->end_key.keypart_map ? - &multi_range_curr->end_key : 0, - test(multi_range_curr->range_flag & EQ_RANGE), - multi_range_sorted); - if (result != HA_ERR_END_OF_FILE) - break; - } - } - while ((result == HA_ERR_END_OF_FILE) && - (multi_range_curr < multi_range_end)); - - *found_range_p= multi_range_curr; - DBUG_PRINT("exit",("handler::read_multi_range_next: result %d", result)); - DBUG_RETURN(result); -} -#endif /** Read first row between two ranges. diff --git a/sql/handler.h b/sql/handler.h index 2ad7d61b03b..ed7426b0811 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1290,15 +1290,6 @@ public: ha_statistics stats; - /** The following are for read_multi_range */ -//////psergey: was: -#if 0 - bool multi_range_sorted; - KEY_MULTI_RANGE *multi_range_curr; - KEY_MULTI_RANGE *multi_range_end; - HANDLER_BUFFER *multi_range_buffer; -#endif -//////psergey /** MultiRangeRead-related members: */ range_seq_t mrr_iter; /* Interator to traverse the range sequence */ RANGE_SEQ_IF mrr_funcs; /* Range sequence traversal functions */ @@ -1311,7 +1302,6 @@ public: bool mrr_have_range; /** Current range (the one we're now returning rows from) */ KEY_MULTI_RANGE mrr_cur_range; -//////psergey /** The following are for read_range() */ key_range save_end_range, *end_range; @@ -1744,13 +1734,6 @@ public: update_index_statistics(); return error; } -#if 0 - virtual int read_multi_range_first(KEY_MULTI_RANGE **found_range_p, - KEY_MULTI_RANGE *ranges, uint range_count, - bool sorted, HANDLER_BUFFER *buffer); - virtual int read_multi_range_next(KEY_MULTI_RANGE **found_range_p); -#endif - //psergey-mrr: virtual ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges, uint *bufsz, @@ -1761,7 +1744,6 @@ public: uint n_ranges, uint mode, HANDLER_BUFFER *buf); virtual int multi_range_read_next(char **range_info); - //psergey-mrr: ends virtual int read_range_first(const key_range *start_key, const key_range *end_key, bool eq_range, bool sorted); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 434afe8fd69..4ea391cbfa0 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -16734,11 +16734,12 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, if (keyno != MAX_KEY && keyno == table->file->pushed_idx_cond_keyno && table->file->pushed_idx_cond) extra.append(STRING_WITH_LEN("; Using index condition")); - /** - psergey-mrr: + /* + psergey: enable the below when we backport BKA: + else if (tab->cache_idx_cond) extra.append(STRING_WITH_LEN("; Using index condition(BKA)")); - **/ + */ if (quick_type == QUICK_SELECT_I::QS_TYPE_ROR_UNION || quick_type == QUICK_SELECT_I::QS_TYPE_ROR_INTERSECT || quick_type == QUICK_SELECT_I::QS_TYPE_INDEX_MERGE) diff --git a/sql/sql_select.h b/sql/sql_select.h index 0a6702a8135..4945d433fac 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -780,7 +780,4 @@ inline bool optimizer_flag(THD *thd, uint flag) void eliminate_tables(JOIN *join); -/// psergey-mrr: -void push_index_cond(JOIN_TAB *tab, uint keyno, bool other_tbls_ok); - |