File: greedy_search_load_tables.inc

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (37 lines) | stat: -rw-r--r-- 1,050 bytes parent folder | download
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
33
34
35
36
37
--disable_query_log
--disable_result_log

# tbl10 and tbl100 are only used to fill the tables used during testing
CREATE TABLE tbl10(
  k INT NOT NULL AUTO_INCREMENT,
  i INT,
  PRIMARY KEY(k)
);
INSERT INTO tbl10(i) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(0);

CREATE TABLE tbl100 LIKE tbl10;
INSERT INTO tbl100(i) SELECT x.i FROM tbl10 AS x, tbl10 AS y;

let $i= 1;
WHILE ($i < 10)
{
  --let $stmt= CREATE TABLE t10_$i (pk int PRIMARY KEY AUTO_INCREMENT, colidx int, col int, index (colidx))
  --eval $stmt;
  --let $stmt= INSERT INTO t10_$i (colidx, col) SELECT k, k FROM tbl10
  --eval $stmt;
  # Update index statistics
  --let $stmt= ANALYZE TABLE t10_$i
  --eval $stmt;

  --let $stmt= CREATE TABLE t100_$i (pk int PRIMARY KEY AUTO_INCREMENT, colidx int, col int, index (colidx))
  --eval $stmt;
  --let $stmt= INSERT INTO t100_$i (colidx, col) SELECT a.k, a.k FROM tbl10 a JOIN tbl10 b;
  --eval $stmt;
  # Update index statistics
  --let $stmt= ANALYZE TABLE t100_$i
  --eval $stmt;

  inc $i;
}  
--enable_result_log
--enable_query_log