1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
source include/have_innodb.inc;
disable_warnings;
drop table if exists t;
enable_warnings;
set session optimizer_switch='extended_keys=on';
select @@optimizer_switch;
create table t (a int not null, b int not null, c int not null, d int not null, primary key(a,b), key(c,a)) engine=innodb;
insert into t values (0,0,0,0),(0,1,0,1);
explain select c,a,b from t where c=0 and a=0 and b=1;
flush status;
select c,a,b from t where c=0 and a=0 and b=1;
show status like 'handler_read%';
explain select c,a,b from t force index (c) where c=0 and a=0 and b=1;
flush status;
select c,a,b from t force index (c) where c=0 and a=0 and b=1;
show status like 'handler_read%';
drop table t;
|