MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
greedy_search_load_tables.inc
1 --disable_query_log
2 --disable_result_log
3 
4 # tbl10 and tbl100 are only used to fill the tables used during testing
5 CREATE TABLE tbl10(
6  k INT NOT NULL AUTO_INCREMENT,
7  i INT,
8  PRIMARY KEY(k)
9 );
10 INSERT INTO tbl10(i) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(0);
11 
12 CREATE TABLE tbl100 LIKE tbl10;
13 INSERT INTO tbl100(i) SELECT x.i FROM tbl10 AS x, tbl10 AS y;
14 
15 let $i= 1;
16 WHILE ($i < 10)
17 {
18  --let $stmt= CREATE TABLE t10_$i (pk int PRIMARY KEY AUTO_INCREMENT, colidx int, col int, index (colidx))
19  --eval $stmt;
20  --let $stmt= INSERT INTO t10_$i (colidx, col) SELECT k, k FROM tbl10
21  --eval $stmt;
22  # Update index statistics
23  ANALYZE TABLE t10_$i;
24 
25  --let $stmt= CREATE TABLE t100_$i (pk int PRIMARY KEY AUTO_INCREMENT, colidx int, col int, index (colidx))
26  --eval $stmt;
27  --let $stmt= INSERT INTO t100_$i (colidx, col) SELECT a.k, a.k FROM tbl10 a JOIN tbl10 b;
28  --eval $stmt;
29  # Update index statistics
30  ANALYZE TABLE t10_$i;
31 
32  inc $i;
33 }
34 --enable_result_log
35 --enable_query_log