1
SET SESSION storage_engine=pbxt;
2
create table t1 (a int primary key);
3
insert into t1 values (1),(2),(3),(4),(100),(200);
4
explain select * from t1 order by a;
5
id select_type table type possible_keys key key_len ref rows Extra
6
1 SIMPLE t1 index NULL PRIMARY 4 NULL 6 Using index; Using filesort
7
select * from t1 order by a;
15
explain select * from t1 where a>4;
16
id select_type table type possible_keys key key_len ref rows Extra
17
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 Using where; Using index
18
select * from t1 where a>4;
22
explain select * from t1 where a<4;
23
id select_type table type possible_keys key key_len ref rows Extra
24
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 Using where; Using index
25
select * from t1 where a<4;
30
explain select * from t1 where a=4;
31
id select_type table type possible_keys key key_len ref rows Extra
32
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
33
select * from t1 where a=4;
37
create table t1 (a int primary key, b varchar(100));
38
insert into t1 values (1, "hello"), (2, "world"), (3, "Beaker"), (4, "Cricket");
39
EXPLAIN SELECT b FROM t1 WHERE a=1;
40
id select_type table type possible_keys key key_len ref rows Extra
41
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
42
SELECT b FROM t1 WHERE a=1;
45
EXPLAIN SELECT b FROM t1 WHERE a=2;
46
id select_type table type possible_keys key key_len ref rows Extra
47
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
48
SELECT b FROM t1 WHERE a=2;
51
EXPLAIN SELECT b FROM t1 WHERE a=3;
52
id select_type table type possible_keys key key_len ref rows Extra
53
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
54
SELECT b FROM t1 WHERE a=3;
57
EXPLAIN SELECT b FROM t1 WHERE a=4;
58
id select_type table type possible_keys key key_len ref rows Extra
59
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
60
SELECT b FROM t1 WHERE a=4;