2 DROP
TABLE IF EXISTS t_10;
3 DROP
TABLE IF EXISTS t_100;
4 DROP
TABLE IF EXISTS t_1000;
5 DROP
TABLE IF EXISTS tp;
6 DROP
TABLE IF EXISTS tsp;
7 DROP
TABLE IF EXISTS t_empty;
8 DROP
TABLE IF EXISTS t_null;
11 eval CREATE
TABLE t_10 (a INT,
13 PRIMARY
KEY (a)) $data_directory $index_directory
14 ENGINE = $engine_table;
16 eval CREATE
TABLE t_100 (a INT,
18 PRIMARY
KEY (a)) $data_directory $index_directory
19 ENGINE = $engine_table;
21 eval CREATE
TABLE t_1000 (a INT,
23 PRIMARY
KEY (a)) $data_directory $index_directory
24 ENGINE = $engine_table;
26 eval CREATE
TABLE t_empty (a INT,
28 PRIMARY
KEY (a)) $data_directory $index_directory
29 ENGINE = $engine_table;
31 eval CREATE
TABLE t_null (a INT,
33 PRIMARY
KEY (a)) $data_directory $index_directory
34 ENGINE = $engine_table;
36 eval CREATE
TABLE tp (a INT,
38 PRIMARY
KEY (a)) $data_directory $index_directory
40 PARTITION BY RANGE (a)
41 (PARTITION p0 VALUES LESS THAN (10) $p_data_directory $p_index_directory,
42 PARTITION p1 VALUES LESS THAN (100) $p_data_directory $p_index_directory,
43 PARTITION p2 VALUES LESS THAN (1000) $p_data_directory $p_index_directory);
45 eval CREATE
TABLE tsp (a INT,
47 PRIMARY
KEY (a)) $data_directory $index_directory
48 ENGINE = $engine_subpart
49 PARTITION BY RANGE (a)
50 SUBPARTITION BY
HASH(a)
51 (PARTITION p0 VALUES LESS THAN (10) $p_data_directory $p_index_directory
57 PARTITION p1 VALUES LESS THAN (100)
58 (SUBPARTITION sp10 $p_data_directory $p_index_directory,
59 SUBPARTITION sp11 $p_data_directory $p_index_directory,
60 SUBPARTITION sp12 $p_data_directory $p_index_directory,
61 SUBPARTITION sp13 $p_data_directory $p_index_directory,
62 SUBPARTITION sp14 $p_data_directory $p_index_directory),
63 PARTITION p2 VALUES LESS THAN (1000) $p_data_directory $p_index_directory
70 # Values t_10 (not partitioned)
71 INSERT INTO t_10 VALUES (1,
"One"), (3,
"Three"), (5,
"Five"), (9,
"Nine");
73 # Values t_100 (not partitioned)
74 INSERT INTO t_100 VALUES (11,
"Eleven"), (13,
"Thirdteen"), (15,
"Fifeteen"), (19,
"Nineteen");
75 INSERT INTO t_100 VALUES (91,
"Ninety-one"), (93,
"Ninety-three"), (95,
"Ninety-five"), (99,
"Ninety-nine");
77 # Values t_1000 (not partitioned)
78 INSERT INTO t_1000 VALUES (111,
"Hundred elven"), (113,
"Hundred thirdteen"), (115,
"Hundred fiveteen"), (119,
"Hundred nineteen");
79 INSERT INTO t_1000 VALUES (131,
"Hundred thirty-one"), (133,
"Hundred thirty-three"), (135,
"Hundred thirty-five"), (139,
"Hundred thirty-nine");
80 INSERT INTO t_1000 VALUES (151,
"Hundred fifty-one"), (153,
"Hundred fifty-three"), (155,
"Hundred fity-five"), (159,
"Hundred fifty-nine");
81 INSERT INTO t_1000 VALUES (191,
"Hundred ninety-one"), (193,
"Hundred ninety-three"), (195,
"Hundred ninety-five"), (199,
"Hundred ninety-nine");
83 # Values t_null (not partitioned)
84 INSERT INTO t_null VALUES (1,
"NULL");
86 # Values tp (partitions)
87 INSERT INTO tp VALUES (2,
"Two"), (4,
"Four"), (6,
"Six"), (8,
"Eight");
88 INSERT INTO tp VALUES (12,
"twelve"), (14,
"Fourteen"), (16,
"Sixteen"), (18,
"Eightteen");
89 INSERT INTO tp VALUES (112,
"Hundred twelve"), (114,
"Hundred fourteen"), (116,
"Hundred sixteen"), (118,
"Hundred eightteen");
90 INSERT INTO tp VALUES (122,
"Hundred twenty-two"), (124,
"Hundred twenty-four"), (126,
"Hundred twenty-six"), (128,
"Hundred twenty-eight");
91 INSERT INTO tp VALUES (162,
"Hundred sixty-two"), (164,
"Hundred sixty-four"), (166,
"Hundred sixty-six"), (168,
"Hundred sixty-eight");
92 INSERT INTO tp VALUES (182,
"Hundred eighty-two"), (184,
"Hundred eighty-four"), (186,
"Hundred eighty-six"), (188,
"Hundred eighty-eight");
94 # Values tps (subpartitions)
95 INSERT INTO tsp VALUES (2,
"Two"), (4,
"Four"), (6,
"Six"), (8,
"Eight");
96 INSERT INTO tsp VALUES (12,
"twelve"), (14,
"Fourteen"), (16,
"Sixteen"), (18,
"Eightteen");
97 INSERT INTO tsp VALUES (112,
"Hundred twelve"), (114,
"Hundred fourteen"), (116,
"Hundred sixteen"), (118,
"Hundred eightteen");
98 INSERT INTO tsp VALUES (122,
"Hundred twenty-two"), (124,
"Hundred twenty-four"), (126,
"Hundred twenty-six"), (128,
"Hundred twenty-eight");
99 INSERT INTO tsp VALUES (162,
"Hundred sixty-two"), (164,
"Hundred sixty-four"), (166,
"Hundred sixty-six"), (168,
"Hundred sixty-eight");
100 INSERT INTO tsp VALUES (182,
"Hundred eight-two"), (184,
"Hundred eighty-four"), (186,
"Hundred eighty-six"), (188,
"Hundred eighty-eight");
102 eval CREATE
TABLE tsp_01(a INT,b VARCHAR(55),PRIMARY
KEY (a))
103 ENGINE = $engine_table $data_directory $index_directory
104 AS SELECT a, b FROM t_10 WHERE MOD(a,5)= 1;
105 eval CREATE
TABLE tsp_02(a INT,b VARCHAR(55),PRIMARY
KEY (a))
106 ENGINE = $engine_table $data_directory $index_directory
107 AS SELECT a, b FROM t_10 WHERE MOD(a,5)= 2;
108 eval CREATE
TABLE tsp_03(a INT,b VARCHAR(55),PRIMARY
KEY (a))
109 ENGINE = $engine_table $data_directory $index_directory
110 AS SELECT a, b FROM t_10 WHERE MOD(a,5)= 3;
111 eval CREATE
TABLE tsp_04(a INT,b VARCHAR(55),PRIMARY
KEY (a))
112 ENGINE = $engine_table $data_directory $index_directory
113 AS SELECT a, b FROM t_10 WHERE MOD(a,5)= 4;
114 eval CREATE
TABLE tsp_00(a INT,b VARCHAR(55),PRIMARY
KEY (a))
115 ENGINE = $engine_table $data_directory $index_directory
116 AS SELECT a, b FROM t_10 WHERE MOD(a,5)= 0;
118 SHOW CREATE
TABLE t_10;
119 SHOW CREATE
TABLE t_100;
120 SHOW CREATE
TABLE t_1000;
121 SHOW CREATE
TABLE tp;
122 SHOW CREATE
TABLE tsp;
129 SELECT * FROM t_1000;
133 SELECT * FROM tp WHERE a< 10;
135 SELECT * FROM tp WHERE a BETWEEN 11 AND 100;
137 SELECT * FROM tp WHERE a BETWEEN 101 AND 200;