mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Merge branch '10.7' into 10.8
This commit is contained in:
@ -1653,8 +1653,8 @@ drop function f1;
|
||||
#
|
||||
create table t1 (a int, b int, key (b), key (a));
|
||||
insert into t1
|
||||
select (rand(1)*1000)/10, (rand(1001)*1000)/50 from seq_1_to_1000;
|
||||
analyze table t1 ;
|
||||
select (rand(1)*1000)/10, (rand(1001)*1000)/20 from seq_1_to_1000;
|
||||
analyze table t1 persistent for all;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Engine-independent statistics collected
|
||||
test.t1 analyze status OK
|
||||
@ -1666,14 +1666,14 @@ Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` USE INDEX () where `test`.`t1`.`a` in (17,51,5)
|
||||
explain extended select * from t1 use index () where b=2;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 5.90 Using where
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 2.40 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` USE INDEX () where `test`.`t1`.`b` = 2
|
||||
# Now, the equality is used for ref access, while the range condition
|
||||
# gives selectivity data
|
||||
explain extended select * from t1 where a in (17,51,5) and b=2;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ref|filter b,a b|a 5|5 const 59 (3%) 2.90 Using where; Using rowid filter
|
||||
1 SIMPLE t1 ref|filter b,a b|a 5|5 const 24 (3%) 2.90 Using where; Using rowid filter
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = 2 and `test`.`t1`.`a` in (17,51,5)
|
||||
drop table t1;
|
||||
@ -1829,6 +1829,12 @@ create table t1 (id int, a int, PRIMARY KEY(id), key(a));
|
||||
insert into t1 select seq,seq from seq_1_to_100;
|
||||
create table t2 (id int, a int, b int, PRIMARY KEY(id), key(a), key(b));
|
||||
insert into t2 select seq,seq,seq from seq_1_to_100;
|
||||
analyze table t1,t2 persistent for all;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Engine-independent statistics collected
|
||||
test.t1 analyze status OK
|
||||
test.t2 analyze status Engine-independent statistics collected
|
||||
test.t2 analyze status OK
|
||||
set optimizer_switch='exists_to_in=off';
|
||||
set optimizer_use_condition_selectivity=2;
|
||||
SELECT * FROM t1
|
||||
@ -1862,7 +1868,7 @@ WHERE A.a=t1.a AND t2.b < 20);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 index NULL a 5 NULL 100 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY A ref PRIMARY,a a 5 test.t1.a 1 Using index
|
||||
2 DEPENDENT SUBQUERY t2 ref|filter a,b a|b 5|5 test.A.id 1 (19%) Using where; Using rowid filter
|
||||
2 DEPENDENT SUBQUERY t2 ref a,b a 5 test.A.id 1 Using where
|
||||
EXPLAIN SELECT * FROM t1 A, t1 B WHERE A.a = B.a and A.id = 65;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE A const PRIMARY,a PRIMARY 4 const 1
|
||||
@ -1874,7 +1880,7 @@ WHERE A.a=t1.a AND t2.b < 20);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 index NULL a 5 NULL 100 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY A ref PRIMARY,a a 5 test.t1.a 1 Using index
|
||||
2 DEPENDENT SUBQUERY t2 ref|filter a,b a|b 5|5 test.A.id 1 (19%) Using where; Using rowid filter
|
||||
2 DEPENDENT SUBQUERY t2 ref a,b a 5 test.A.id 1 Using where
|
||||
set optimizer_switch= @save_optimizer_switch;
|
||||
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
|
||||
drop table t1,t2;
|
||||
|
Reference in New Issue
Block a user