2 ** This script sets up five different tasks all writing and updating
3 ** the database at the same time, but each in its own table.
6 DROP TABLE IF EXISTS t1;
7 CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
9 INSERT INTO t1 VALUES(1, randomblob(2000));
10 INSERT INTO t1 VALUES(2, randomblob(1000));
12 INSERT INTO t1 SELECT a+2, randomblob(1500) FROM t1;
13 INSERT INTO t1 SELECT a+4, randomblob(1500) FROM t1;
14 INSERT INTO t1 SELECT a+8, randomblob(1500) FROM t1;
16 INSERT INTO t1 SELECT a+16, randomblob(1500) FROM t1;
18 INSERT INTO t1 SELECT a+32, randomblob(1500) FROM t1;
19 SELECT count(*) FROM t1;
21 SELECT avg(length(b)) FROM t1;
24 UPDATE t1 SET b='x'||a||'y';
25 SELECT sum(length(b)) FROM t1;
27 SELECT a FROM t1 WHERE b='x17y';
29 CREATE INDEX t1b ON t1(b);
30 SELECT a FROM t1 WHERE b='x17y';
32 SELECT a FROM t1 WHERE b GLOB 'x2?y' ORDER BY b DESC LIMIT 5;
33 --match 29 28 27 26 25
38 DROP TABLE IF EXISTS t2;
39 CREATE TABLE t2(a INTEGER PRIMARY KEY, b);
41 INSERT INTO t2 VALUES(1, randomblob(2000));
42 INSERT INTO t2 VALUES(2, randomblob(1000));
44 INSERT INTO t2 SELECT a+2, randomblob(1500) FROM t2;
45 INSERT INTO t2 SELECT a+4, randomblob(1500) FROM t2;
46 INSERT INTO t2 SELECT a+8, randomblob(1500) FROM t2;
48 INSERT INTO t2 SELECT a+16, randomblob(1500) FROM t2;
50 INSERT INTO t2 SELECT a+32, randomblob(1500) FROM t2;
51 SELECT count(*) FROM t2;
53 SELECT avg(length(b)) FROM t2;
56 UPDATE t2 SET b='x'||a||'y';
57 SELECT sum(length(b)) FROM t2;
59 SELECT a FROM t2 WHERE b='x17y';
61 CREATE INDEX t2b ON t2(b);
62 SELECT a FROM t2 WHERE b='x17y';
64 SELECT a FROM t2 WHERE b GLOB 'x2?y' ORDER BY b DESC LIMIT 5;
65 --match 29 28 27 26 25
69 DROP TABLE IF EXISTS t3;
70 CREATE TABLE t3(a INTEGER PRIMARY KEY, b);
72 INSERT INTO t3 VALUES(1, randomblob(2000));
73 INSERT INTO t3 VALUES(2, randomblob(1000));
75 INSERT INTO t3 SELECT a+2, randomblob(1500) FROM t3;
76 INSERT INTO t3 SELECT a+4, randomblob(1500) FROM t3;
77 INSERT INTO t3 SELECT a+8, randomblob(1500) FROM t3;
79 INSERT INTO t3 SELECT a+16, randomblob(1500) FROM t3;
81 INSERT INTO t3 SELECT a+32, randomblob(1500) FROM t3;
82 SELECT count(*) FROM t3;
84 SELECT avg(length(b)) FROM t3;
87 UPDATE t3 SET b='x'||a||'y';
88 SELECT sum(length(b)) FROM t3;
90 SELECT a FROM t3 WHERE b='x17y';
92 CREATE INDEX t3b ON t3(b);
93 SELECT a FROM t3 WHERE b='x17y';
95 SELECT a FROM t3 WHERE b GLOB 'x2?y' ORDER BY b DESC LIMIT 5;
96 --match 29 28 27 26 25
100 DROP TABLE IF EXISTS t4;
101 CREATE TABLE t4(a INTEGER PRIMARY KEY, b);
103 INSERT INTO t4 VALUES(1, randomblob(2000));
104 INSERT INTO t4 VALUES(2, randomblob(1000));
106 INSERT INTO t4 SELECT a+2, randomblob(1500) FROM t4;
107 INSERT INTO t4 SELECT a+4, randomblob(1500) FROM t4;
108 INSERT INTO t4 SELECT a+8, randomblob(1500) FROM t4;
110 INSERT INTO t4 SELECT a+16, randomblob(1500) FROM t4;
112 INSERT INTO t4 SELECT a+32, randomblob(1500) FROM t4;
113 SELECT count(*) FROM t4;
115 SELECT avg(length(b)) FROM t4;
118 UPDATE t4 SET b='x'||a||'y';
119 SELECT sum(length(b)) FROM t4;
121 SELECT a FROM t4 WHERE b='x17y';
123 CREATE INDEX t4b ON t4(b);
124 SELECT a FROM t4 WHERE b='x17y';
126 SELECT a FROM t4 WHERE b GLOB 'x2?y' ORDER BY b DESC LIMIT 5;
127 --match 29 28 27 26 25
131 DROP TABLE IF EXISTS t5;
132 CREATE TABLE t5(a INTEGER PRIMARY KEY, b);
134 INSERT INTO t5 VALUES(1, randomblob(2000));
135 INSERT INTO t5 VALUES(2, randomblob(1000));
137 INSERT INTO t5 SELECT a+2, randomblob(1500) FROM t5;
138 INSERT INTO t5 SELECT a+4, randomblob(1500) FROM t5;
139 INSERT INTO t5 SELECT a+8, randomblob(1500) FROM t5;
141 INSERT INTO t5 SELECT a+16, randomblob(1500) FROM t5;
143 INSERT INTO t5 SELECT a+32, randomblob(1500) FROM t5;
144 SELECT count(*) FROM t5;
146 SELECT avg(length(b)) FROM t5;
149 UPDATE t5 SET b='x'||a||'y';
150 SELECT sum(length(b)) FROM t5;
152 SELECT a FROM t5 WHERE b='x17y';
154 CREATE INDEX t5b ON t5(b);
155 SELECT a FROM t5 WHERE b='x17y';
157 SELECT a FROM t5 WHERE b GLOB 'x2?y' ORDER BY b DESC LIMIT 5;
158 --match 29 28 27 26 25
162 SELECT count(*), sum(length(b)) FROM t1;
164 SELECT count(*), sum(length(b)) FROM t2;
166 SELECT count(*), sum(length(b)) FROM t3;
168 SELECT count(*), sum(length(b)) FROM t4;
170 SELECT count(*), sum(length(b)) FROM t5;
174 SELECT t1.a FROM t1, t2
175 WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
176 ORDER BY t1.a LIMIT 4
178 SELECT t3.a FROM t3, t4
179 WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
180 ORDER BY t3.a LIMIT 7
181 --match 45 46 47 48 49 50 51
184 SELECT t1.a FROM t1, t2
185 WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
186 ORDER BY t1.a LIMIT 4
188 SELECT t3.a FROM t3, t4
189 WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
190 ORDER BY t3.a LIMIT 7
191 --match 45 46 47 48 49 50 51
194 SELECT t1.a FROM t1, t2
195 WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
196 ORDER BY t1.a LIMIT 4
198 SELECT t3.a FROM t3, t4
199 WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
200 ORDER BY t3.a LIMIT 7
201 --match 45 46 47 48 49 50 51
204 SELECT t1.a FROM t1, t2
205 WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
206 ORDER BY t1.a LIMIT 4
208 SELECT t3.a FROM t3, t4
209 WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
210 ORDER BY t3.a LIMIT 7
211 --match 45 46 47 48 49 50 51
214 SELECT t1.a FROM t1, t2
215 WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
216 ORDER BY t1.a LIMIT 4
218 SELECT t3.a FROM t3, t4
219 WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
220 ORDER BY t3.a LIMIT 7
221 --match 45 46 47 48 49 50 51
228 PRAGMA integrity_check(10);
230 CREATE INDEX t5b ON t5(b DESC);
235 PRAGMA integrity_check(10);
237 CREATE INDEX t3b ON t3(b DESC);
242 PRAGMA integrity_check(10);
244 CREATE INDEX t1b ON t1(b DESC);
249 PRAGMA integrity_check(10);
251 CREATE INDEX t2b ON t2(b DESC);
256 PRAGMA integrity_check(10);
258 CREATE INDEX t4b ON t4(b DESC);
263 SELECT t1.a FROM t1, t2
264 WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
265 ORDER BY t1.a LIMIT 4
267 SELECT t3.a FROM t3, t4
268 WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
269 ORDER BY t3.a LIMIT 7
270 --match 45 46 47 48 49 50 51
273 SELECT t1.a FROM t1, t2
274 WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
275 ORDER BY t1.a LIMIT 4
277 SELECT t3.a FROM t3, t4
278 WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
279 ORDER BY t3.a LIMIT 7
280 --match 45 46 47 48 49 50 51
283 SELECT t1.a FROM t1, t2
284 WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
285 ORDER BY t1.a LIMIT 4
287 SELECT t3.a FROM t3, t4
288 WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
289 ORDER BY t3.a LIMIT 7
290 --match 45 46 47 48 49 50 51
293 SELECT t1.a FROM t1, t2
294 WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
295 ORDER BY t1.a LIMIT 4
297 SELECT t3.a FROM t3, t4
298 WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
299 ORDER BY t3.a LIMIT 7
300 --match 45 46 47 48 49 50 51
303 SELECT t1.a FROM t1, t2
304 WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
305 ORDER BY t1.a LIMIT 4
307 SELECT t3.a FROM t3, t4
308 WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
309 ORDER BY t3.a LIMIT 7
310 --match 45 46 47 48 49 50 51
315 PRAGMA integrity_check(10);
319 UPDATE t1 SET b=randomblob(20000);
321 UPDATE t1 SET b='x'||a||'y';
322 SELECT a FROM t1 WHERE b='x63y';
326 UPDATE t2 SET b=randomblob(20000);
328 UPDATE t2 SET b='x'||a||'y';
329 SELECT a FROM t2 WHERE b='x63y';
333 UPDATE t3 SET b=randomblob(20000);
335 UPDATE t3 SET b='x'||a||'y';
336 SELECT a FROM t3 WHERE b='x63y';
340 UPDATE t4 SET b=randomblob(20000);
342 UPDATE t4 SET b='x'||a||'y';
343 SELECT a FROM t4 WHERE b='x63y';
347 UPDATE t5 SET b=randomblob(20000);
349 UPDATE t5 SET b='x'||a||'y';
350 SELECT a FROM t5 WHERE b='x63y';
356 SELECT t1.a FROM t1, t2
357 WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
358 ORDER BY t1.a LIMIT 4
360 SELECT t3.a FROM t3, t4
361 WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
362 ORDER BY t3.a LIMIT 7
363 --match 45 46 47 48 49 50 51
364 PRAGMA integrity_check;
368 SELECT t1.a FROM t1, t2
369 WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
370 ORDER BY t1.a LIMIT 4
372 SELECT t3.a FROM t3, t4
373 WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
374 ORDER BY t3.a LIMIT 7
375 --match 45 46 47 48 49 50 51
376 PRAGMA integrity_check;
380 SELECT t1.a FROM t1, t2
381 WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
382 ORDER BY t1.a LIMIT 4
384 SELECT t3.a FROM t3, t4
385 WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
386 ORDER BY t3.a LIMIT 7
387 --match 45 46 47 48 49 50 51
388 PRAGMA integrity_check;
392 SELECT t1.a FROM t1, t2
393 WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
394 ORDER BY t1.a LIMIT 4
396 SELECT t3.a FROM t3, t4
397 WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
398 ORDER BY t3.a LIMIT 7
399 --match 45 46 47 48 49 50 51
400 PRAGMA integrity_check;
404 SELECT t1.a FROM t1, t2
405 WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
406 ORDER BY t1.a LIMIT 4
408 SELECT t3.a FROM t3, t4
409 WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
410 ORDER BY t3.a LIMIT 7
411 --match 45 46 47 48 49 50 51
412 PRAGMA integrity_check;