~clint-fewbar/drizzle/regex-policy-cache-limiter

« back to all changes in this revision

Viewing changes to plugin/blitzdb/tests/t/indexes.test

  • Committer: Clint Byrum
  • Date: 2012-03-15 18:05:43 UTC
  • mfrom: (2224.1.302 workspace)
  • Revision ID: clint@ubuntu.com-20120315180543-9jxxm4q10k3np2ws
merging with latest trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Test Routine for Multi Index Tables in BlitzDB
2
 
 
3
 
--disable_warnings
4
 
drop table if exists t1;
5
 
--enable_warnings
6
 
 
7
 
# Two Keys: Primary Key + Index
8
 
create table t1 (a int, b int, c int, primary key(a), index(b)) engine = blitzdb;
9
 
  insert into t1 values (1, 1, 100), (2, 2, 200), (3, 3, 300), (4, 4, 400);
10
 
  insert into t1 values (5, 5, 500), (6, 6, 600), (7, 7, 700), (8, 8, 800);
11
 
  select * from t1 order by (a);
12
 
  select * from t1 order by (a) desc;
13
 
 
14
 
  # Primary Key Read
15
 
  explain select * from t1 where a <= 4;
16
 
  select * from t1 where a <= 4;
17
 
  explain select * from t1 where a > 2 and a < 6;
18
 
  select * from t1 where a > 2 and a < 6;
19
 
 
20
 
  # Index Scan Read
21
 
  explain select * from t1 where b <= 4;
22
 
  select * from t1 where b <= 4;
23
 
  explain select * from t1 where b > 2 and b < 6;
24
 
  select * from t1 where b > 2 and b < 6;
25
 
 
26
 
  # Needle in a Haystack
27
 
  explain select c from t1 where a = 8;
28
 
  select c from t1 where a = 8;
29
 
  explain select c from t1 where b = 3;
30
 
  select c from t1 where b = 3;
31
 
 
32
 
  # Delete rows by PK and make sure it can't be fetched with
33
 
  # the secondary index. Reason: Row(s) should not exist.
34
 
  select * from t1 where a = 1;
35
 
  select * from t1 where b = 1;
36
 
  delete from t1 where a = 1;
37
 
  select * from t1 where a = 1;
38
 
  select * from t1 where b = 1;
39
 
 
40
 
  select * from t1 where a >= 2 and a <= 4;
41
 
  select * from t1 where b >= 2 and b <= 4;
42
 
  delete from t1 where a >= 2 and a <= 4;
43
 
  select * from t1 where a >= 2 and a <= 4;
44
 
  select * from t1 where b >= 2 and b <= 4;
45
 
drop table t1;