-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathseed.sql
More file actions
32 lines (26 loc) 路 813 Bytes
/
Copy pathseed.sql
File metadata and controls
32 lines (26 loc) 路 813 Bytes
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
-- Seed a big table for exercising the tracer's row-count + timing output.
-- Usage: sqlite3 /tmp/t.db < seed.sql
-- Override the row count: sqlite3 /tmp/t.db --cmd ".param set :n 1000000" < seed.sql
-- (defaults to 500000 if :n is unset)
PRAGMA journal_mode = WAL;
PRAGMA synchronous = NORMAL;
DROP TABLE IF EXISTS big;
CREATE TABLE big (
id INTEGER PRIMARY KEY,
k INTEGER NOT NULL,
g INTEGER NOT NULL,
label TEXT NOT NULL,
val REAL NOT NULL
);
INSERT INTO big (id, k, g, label, val)
SELECT
value,
abs(random() % 1000000),
value % 100,
'row-' || value,
(random() % 1000000) / 1000.0
FROM generate_series(1, coalesce(:n, 500000));
CREATE INDEX idx_big_k ON big(k);
CREATE INDEX idx_big_g ON big(g);
ANALYZE;
SELECT count(*) AS rows_seeded, count(DISTINCT g) AS groups FROM big;