1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
create table t1(a blob unique , b blob , c blob, unique(b,c));
insert into t1 values(1,1,1);
insert into t1 values(2,2,2),(3,3,3),(4,4,4),(5,5,5);
insert into t1 select a+5, b+5, c+5 from t1;
insert into t1 select a+10, b+10, c+10 from t1;
insert into t1 select a+20, b+20, c+20 from t1;
insert into t1 select a+40, b+40, c+40 from t1;
explain select * from t1 where a="34";;
id 1
select_type SIMPLE
table t1
type ref
possible_keys a
key a
key_len 9
ref const
rows 8
Extra Using where; Full scan on NULL key
explain select * from t1 where b="34" and c = "34";;
id 1
select_type SIMPLE
table t1
type ref
possible_keys b
key b
key_len 9
ref const
rows 8
Extra Using where; Full scan on NULL key
explain select * from t1 where c="34" and b="34";;
id 1
select_type SIMPLE
table t1
type ref
possible_keys b
key b
key_len 9
ref const
rows 8
Extra Using where; Full scan on NULL key
explain select * from t1 where c="34";;
id 1
select_type SIMPLE
table t1
type ALL
possible_keys NULL
key NULL
key_len NULL
ref NULL
rows 80
Extra Using where
explain select * from t1 where b="34";;
id 1
select_type SIMPLE
table t1
type ALL
possible_keys b
key NULL
key_len NULL
ref NULL
rows 80
Extra Using where
select * from t1 where a="34";
a b c
34 34 34
select * from t1 where b="34" and c = "34";
a b c
34 34 34
select * from t1 where c="34" and b="34";
a b c
34 34 34
select * from t1 where c="34";
a b c
34 34 34
select * from t1 where b="34";
a b c
34 34 34
drop table t1;
|