1
drop table if exists t1;
2
create table t1 (a int, b int, c int, primary key(a), index(b)) engine = blitzdb;
3
insert into t1 values (1, 1, 100), (2, 2, 200), (3, 3, 300), (4, 4, 400);
4
insert into t1 values (5, 5, 500), (6, 6, 600), (7, 7, 700), (8, 8, 800);
5
select * from t1 order by (a);
15
select * from t1 order by (a) desc;
25
explain select * from t1 where a <= 4;
26
id select_type table type possible_keys key key_len ref rows Extra
27
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using where
28
select * from t1 where a <= 4;
34
explain select * from t1 where a > 2 and a < 6;
35
id select_type table type possible_keys key key_len ref rows Extra
36
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using where
37
select * from t1 where a > 2 and a < 6;
42
explain select * from t1 where b <= 4;
43
id select_type table type possible_keys key key_len ref rows Extra
44
1 SIMPLE t1 range b b 5 NULL 4 Using where
45
select * from t1 where b <= 4;
51
explain select * from t1 where b > 2 and b < 6;
52
id select_type table type possible_keys key key_len ref rows Extra
53
1 SIMPLE t1 range b b 5 NULL 4 Using where
54
select * from t1 where b > 2 and b < 6;
59
explain select c from t1 where a = 8;
60
id select_type table type possible_keys key key_len ref rows Extra
61
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
62
select c from t1 where a = 8;
65
explain select c from t1 where b = 3;
66
id select_type table type possible_keys key key_len ref rows Extra
67
1 SIMPLE t1 ref b b 5 const 4 Using where
68
select c from t1 where b = 3;
71
select * from t1 where a = 1;
74
select * from t1 where b = 1;
77
delete from t1 where a = 1;
78
select * from t1 where a = 1;
80
select * from t1 where b = 1;
82
select * from t1 where a >= 2 and a <= 4;
87
select * from t1 where b >= 2 and b <= 4;
92
delete from t1 where a >= 2 and a <= 4;
93
select * from t1 where a >= 2 and a <= 4;
95
select * from t1 where b >= 2 and b <= 4;