2
SET @@session.storage_engine = 'MyISAM';
4
#------------------------------------------------------------------------
5
# 0. Setting of auxiliary variables + Creation of an auxiliary tables
6
# needed in many testcases
7
#------------------------------------------------------------------------
8
SELECT @max_row DIV 2 INTO @max_row_div2;
9
SELECT @max_row DIV 3 INTO @max_row_div3;
10
SELECT @max_row DIV 4 INTO @max_row_div4;
11
SET @max_int_4 = 2147483647;
12
DROP TABLE IF EXISTS t0_template;
13
CREATE TABLE t0_template (
18
f_charbig VARCHAR(1000) ,
21
# Logging of <max_row> INSERTs into t0_template suppressed
22
DROP TABLE IF EXISTS t0_definition;
23
CREATE TABLE t0_definition (
25
create_command VARBINARY(5000),
26
file_list VARBINARY(10000),
29
DROP TABLE IF EXISTS t0_aux;
30
CREATE TABLE t0_aux ( f_int1 INTEGER,
34
f_charbig VARCHAR(1000) )
37
SET @@session.sql_mode= '';
38
# End of basic preparations needed for all tests
39
#-----------------------------------------------
41
#========================================================================
42
# 1. Partition management commands on HASH partitioned table
43
# column in partitioning function is of type DATE
44
#========================================================================
45
DROP TABLE IF EXISTS t1;
46
CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30));
47
INSERT INTO t1 (f_date, f_varchar)
48
SELECT CONCAT(CAST((f_int1 + 999) AS CHAR),'-02-10'), CAST(f_char1 AS CHAR)
50
WHERE f_int1 + 999 BETWEEN 1000 AND 9999;
51
SELECT IF(9999 - 1000 + 1 > @max_row, @max_row , 9999 - 1000 + 1)
55
t1 CREATE TABLE `t1` (
56
`f_date` date DEFAULT NULL,
57
`f_varchar` varchar(30) DEFAULT NULL
58
) ENGINE=MyISAM DEFAULT CHARSET=latin1
59
MYSQLTEST_VARDIR/master-data/test/t1.MYD
60
MYSQLTEST_VARDIR/master-data/test/t1.MYI
61
MYSQLTEST_VARDIR/master-data/test/t1.frm
62
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
63
id select_type table partitions type possible_keys key key_len ref rows Extra
64
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using where
65
# check read single success: 1
66
# check read all success: 1
67
# check read row by row success: 1
68
#------------------------------------------------------------------------
69
# 1.1 Increase number of PARTITIONS
70
#------------------------------------------------------------------------
71
# 1.1.1 ADD PARTITION to not partitioned table --> must fail
72
ALTER TABLE t1 ADD PARTITION (PARTITION part2);
73
ERROR HY000: Partition management on a not partitioned table is not possible
74
# 1.1.2 Assign HASH partitioning
75
ALTER TABLE t1 PARTITION BY HASH(YEAR(f_date));
78
t1 CREATE TABLE `t1` (
79
`f_date` date DEFAULT NULL,
80
`f_varchar` varchar(30) DEFAULT NULL
81
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (YEAR(f_date)) */
82
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
83
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
84
MYSQLTEST_VARDIR/master-data/test/t1.frm
85
MYSQLTEST_VARDIR/master-data/test/t1.par
86
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
87
id select_type table partitions type possible_keys key key_len ref rows Extra
88
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 Using where
89
# check read single success: 1
90
# check read all success: 1
91
# check read row by row success: 1
92
# 1.1.3 Assign other HASH partitioning to already partitioned table
93
# + test and switch back + test
94
ALTER TABLE t1 PARTITION BY HASH(DAYOFYEAR(f_date));
97
t1 CREATE TABLE `t1` (
98
`f_date` date DEFAULT NULL,
99
`f_varchar` varchar(30) DEFAULT NULL
100
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (DAYOFYEAR(f_date)) */
101
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
102
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
103
MYSQLTEST_VARDIR/master-data/test/t1.frm
104
MYSQLTEST_VARDIR/master-data/test/t1.par
105
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
106
id select_type table partitions type possible_keys key key_len ref rows Extra
107
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 Using where
108
# check read single success: 1
109
# check read all success: 1
110
# check read row by row success: 1
111
ALTER TABLE t1 PARTITION BY HASH(YEAR(f_date));
112
SHOW CREATE TABLE t1;
114
t1 CREATE TABLE `t1` (
115
`f_date` date DEFAULT NULL,
116
`f_varchar` varchar(30) DEFAULT NULL
117
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (YEAR(f_date)) */
118
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
119
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
120
MYSQLTEST_VARDIR/master-data/test/t1.frm
121
MYSQLTEST_VARDIR/master-data/test/t1.par
122
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
123
id select_type table partitions type possible_keys key key_len ref rows Extra
124
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 Using where
125
# check read single success: 1
126
# check read all success: 1
127
# check read row by row success: 1
128
# 1.1.4 Add PARTITIONS not fitting to HASH --> must fail
129
ALTER TABLE t1 ADD PARTITION (PARTITION part1 VALUES IN (0));
130
ERROR HY000: Only LIST PARTITIONING can use VALUES IN in partition definition
131
ALTER TABLE t1 ADD PARTITION (PARTITION part2 VALUES LESS THAN (0));
132
ERROR HY000: Only RANGE PARTITIONING can use VALUES LESS THAN in partition definition
133
# 1.1.5 Add two named partitions + test
134
ALTER TABLE t1 ADD PARTITION (PARTITION part1, PARTITION part7);
135
SHOW CREATE TABLE t1;
137
t1 CREATE TABLE `t1` (
138
`f_date` date DEFAULT NULL,
139
`f_varchar` varchar(30) DEFAULT NULL
140
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM) */
141
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
142
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
143
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD
144
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI
145
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYD
146
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYI
147
MYSQLTEST_VARDIR/master-data/test/t1.frm
148
MYSQLTEST_VARDIR/master-data/test/t1.par
149
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
150
id select_type table partitions type possible_keys key key_len ref rows Extra
151
1 SIMPLE t1 part1 ALL NULL NULL NULL NULL 7 Using where
152
# check read single success: 1
153
# check read all success: 1
154
# check read row by row success: 1
155
# 1.1.6 Add two named partitions, name clash --> must fail
156
ALTER TABLE t1 ADD PARTITION (PARTITION part1, PARTITION part7);
157
ERROR HY000: Duplicate partition name part1
158
# 1.1.7 Add one named partition + test
159
ALTER TABLE t1 ADD PARTITION (PARTITION part2);
160
SHOW CREATE TABLE t1;
162
t1 CREATE TABLE `t1` (
163
`f_date` date DEFAULT NULL,
164
`f_varchar` varchar(30) DEFAULT NULL
165
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) */
166
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
167
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
168
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD
169
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI
170
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD
171
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI
172
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYD
173
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYI
174
MYSQLTEST_VARDIR/master-data/test/t1.frm
175
MYSQLTEST_VARDIR/master-data/test/t1.par
176
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
177
id select_type table partitions type possible_keys key key_len ref rows Extra
178
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where
179
# check read single success: 1
180
# check read all success: 1
181
# check read row by row success: 1
182
# 1.1.8 Add four not named partitions + test
183
ALTER TABLE t1 ADD PARTITION PARTITIONS 4;
184
SHOW CREATE TABLE t1;
186
t1 CREATE TABLE `t1` (
187
`f_date` date DEFAULT NULL,
188
`f_varchar` varchar(30) DEFAULT NULL
189
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM, PARTITION p4 ENGINE = MyISAM, PARTITION p5 ENGINE = MyISAM, PARTITION p6 ENGINE = MyISAM, PARTITION p7 ENGINE = MyISAM) */
190
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
191
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
192
MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD
193
MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI
194
MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYD
195
MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYI
196
MYSQLTEST_VARDIR/master-data/test/t1#P#p6.MYD
197
MYSQLTEST_VARDIR/master-data/test/t1#P#p6.MYI
198
MYSQLTEST_VARDIR/master-data/test/t1#P#p7.MYD
199
MYSQLTEST_VARDIR/master-data/test/t1#P#p7.MYI
200
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD
201
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI
202
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD
203
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI
204
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYD
205
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYI
206
MYSQLTEST_VARDIR/master-data/test/t1.frm
207
MYSQLTEST_VARDIR/master-data/test/t1.par
208
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
209
id select_type table partitions type possible_keys key key_len ref rows Extra
210
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 3 Using where
211
# check read single success: 1
212
# check read all success: 1
213
# check read row by row success: 1
214
#------------------------------------------------------------------------
215
# 1.2 Decrease number of PARTITIONS
216
#------------------------------------------------------------------------
217
# 1.2.1 DROP PARTITION is not supported for HASH --> must fail
218
ALTER TABLE t1 DROP PARTITION part1;
219
ERROR HY000: DROP PARTITION can only be used on RANGE/LIST partitions
220
# 1.2.2 COALESCE PARTITION partitionname is not supported
221
ALTER TABLE t1 COALESCE PARTITION part1;
222
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'part1' at line 1
223
# 1.2.3 Decrease by 0 is non sense --> must fail
224
ALTER TABLE t1 COALESCE PARTITION 0;
225
ERROR HY000: At least one partition must be coalesced
226
# 1.2.4 COALESCE one partition + test loop
227
ALTER TABLE t1 COALESCE PARTITION 1;
228
SHOW CREATE TABLE t1;
230
t1 CREATE TABLE `t1` (
231
`f_date` date DEFAULT NULL,
232
`f_varchar` varchar(30) DEFAULT NULL
233
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM, PARTITION p4 ENGINE = MyISAM, PARTITION p5 ENGINE = MyISAM, PARTITION p6 ENGINE = MyISAM) */
234
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
235
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
236
MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD
237
MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI
238
MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYD
239
MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYI
240
MYSQLTEST_VARDIR/master-data/test/t1#P#p6.MYD
241
MYSQLTEST_VARDIR/master-data/test/t1#P#p6.MYI
242
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD
243
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI
244
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD
245
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI
246
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYD
247
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYI
248
MYSQLTEST_VARDIR/master-data/test/t1.frm
249
MYSQLTEST_VARDIR/master-data/test/t1.par
250
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
251
id select_type table partitions type possible_keys key key_len ref rows Extra
252
1 SIMPLE t1 p6 ALL NULL NULL NULL NULL 3 Using where
253
# check read single success: 1
254
# check read all success: 1
255
# check read row by row success: 1
256
ALTER TABLE t1 COALESCE PARTITION 1;
257
SHOW CREATE TABLE t1;
259
t1 CREATE TABLE `t1` (
260
`f_date` date DEFAULT NULL,
261
`f_varchar` varchar(30) DEFAULT NULL
262
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM, PARTITION p4 ENGINE = MyISAM, PARTITION p5 ENGINE = MyISAM) */
263
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
264
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
265
MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD
266
MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI
267
MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYD
268
MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYI
269
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD
270
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI
271
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD
272
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI
273
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYD
274
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYI
275
MYSQLTEST_VARDIR/master-data/test/t1.frm
276
MYSQLTEST_VARDIR/master-data/test/t1.par
277
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
278
id select_type table partitions type possible_keys key key_len ref rows Extra
279
1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 4 Using where
280
# check read single success: 1
281
# check read all success: 1
282
# check read row by row success: 1
283
ALTER TABLE t1 COALESCE PARTITION 1;
284
SHOW CREATE TABLE t1;
286
t1 CREATE TABLE `t1` (
287
`f_date` date DEFAULT NULL,
288
`f_varchar` varchar(30) DEFAULT NULL
289
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM, PARTITION p4 ENGINE = MyISAM) */
290
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
291
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
292
MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD
293
MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI
294
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD
295
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI
296
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD
297
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI
298
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYD
299
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYI
300
MYSQLTEST_VARDIR/master-data/test/t1.frm
301
MYSQLTEST_VARDIR/master-data/test/t1.par
302
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
303
id select_type table partitions type possible_keys key key_len ref rows Extra
304
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 4 Using where
305
# check read single success: 1
306
# check read all success: 1
307
# check read row by row success: 1
308
ALTER TABLE t1 COALESCE PARTITION 1;
309
SHOW CREATE TABLE t1;
311
t1 CREATE TABLE `t1` (
312
`f_date` date DEFAULT NULL,
313
`f_varchar` varchar(30) DEFAULT NULL
314
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) */
315
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
316
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
317
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD
318
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI
319
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD
320
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI
321
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYD
322
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYI
323
MYSQLTEST_VARDIR/master-data/test/t1.frm
324
MYSQLTEST_VARDIR/master-data/test/t1.par
325
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
326
id select_type table partitions type possible_keys key key_len ref rows Extra
327
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where
328
# check read single success: 1
329
# check read all success: 1
330
# check read row by row success: 1
331
ALTER TABLE t1 COALESCE PARTITION 1;
332
SHOW CREATE TABLE t1;
334
t1 CREATE TABLE `t1` (
335
`f_date` date DEFAULT NULL,
336
`f_varchar` varchar(30) DEFAULT NULL
337
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM) */
338
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
339
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
340
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD
341
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI
342
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYD
343
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYI
344
MYSQLTEST_VARDIR/master-data/test/t1.frm
345
MYSQLTEST_VARDIR/master-data/test/t1.par
346
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
347
id select_type table partitions type possible_keys key key_len ref rows Extra
348
1 SIMPLE t1 part1 ALL NULL NULL NULL NULL 7 Using where
349
# check read single success: 1
350
# check read all success: 1
351
# check read row by row success: 1
352
ALTER TABLE t1 COALESCE PARTITION 1;
353
SHOW CREATE TABLE t1;
355
t1 CREATE TABLE `t1` (
356
`f_date` date DEFAULT NULL,
357
`f_varchar` varchar(30) DEFAULT NULL
358
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM) */
359
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
360
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
361
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD
362
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI
363
MYSQLTEST_VARDIR/master-data/test/t1.frm
364
MYSQLTEST_VARDIR/master-data/test/t1.par
365
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
366
id select_type table partitions type possible_keys key key_len ref rows Extra
367
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 10 Using where
368
# check read single success: 1
369
# check read all success: 1
370
# check read row by row success: 1
371
ALTER TABLE t1 COALESCE PARTITION 1;
372
SHOW CREATE TABLE t1;
374
t1 CREATE TABLE `t1` (
375
`f_date` date DEFAULT NULL,
376
`f_varchar` varchar(30) DEFAULT NULL
377
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = MyISAM) */
378
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
379
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
380
MYSQLTEST_VARDIR/master-data/test/t1.frm
381
MYSQLTEST_VARDIR/master-data/test/t1.par
382
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
383
id select_type table partitions type possible_keys key key_len ref rows Extra
384
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 Using where
385
# check read single success: 1
386
# check read all success: 1
387
# check read row by row success: 1
388
# 1.2.5 COALESCE of last partition --> must fail
389
ALTER TABLE t1 COALESCE PARTITION 1;
390
ERROR HY000: Cannot remove all partitions, use DROP TABLE instead
391
# 1.2.6 Remove partitioning
392
ALTER TABLE t1 REMOVE PARTITIONING;
393
SHOW CREATE TABLE t1;
395
t1 CREATE TABLE `t1` (
396
`f_date` date DEFAULT NULL,
397
`f_varchar` varchar(30) DEFAULT NULL
398
) ENGINE=MyISAM DEFAULT CHARSET=latin1
399
MYSQLTEST_VARDIR/master-data/test/t1.MYD
400
MYSQLTEST_VARDIR/master-data/test/t1.MYI
401
MYSQLTEST_VARDIR/master-data/test/t1.frm
402
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
403
id select_type table partitions type possible_keys key key_len ref rows Extra
404
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using where
405
# check read single success: 1
406
# check read all success: 1
407
# check read row by row success: 1
408
# 1.2.7 Remove partitioning from not partitioned table --> ????
409
ALTER TABLE t1 REMOVE PARTITIONING;
412
#========================================================================
413
# 2. Partition management commands on KEY partitioned table
414
#========================================================================
415
DROP TABLE IF EXISTS t1;
421
f_charbig VARCHAR(1000)
423
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
424
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
425
SHOW CREATE TABLE t1;
427
t1 CREATE TABLE `t1` (
428
`f_int1` int(11) DEFAULT NULL,
429
`f_int2` int(11) DEFAULT NULL,
430
`f_char1` char(20) DEFAULT NULL,
431
`f_char2` char(20) DEFAULT NULL,
432
`f_charbig` varchar(1000) DEFAULT NULL
433
) ENGINE=MyISAM DEFAULT CHARSET=latin1
434
MYSQLTEST_VARDIR/master-data/test/t1.MYD
435
MYSQLTEST_VARDIR/master-data/test/t1.MYI
436
MYSQLTEST_VARDIR/master-data/test/t1.frm
437
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
438
id select_type table partitions type possible_keys key key_len ref rows Extra
439
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using where
440
# check read single success: 1
441
# check read all success: 1
442
# check read row by row success: 1
443
#------------------------------------------------------------------------
444
# 2.1 Increase number of PARTITIONS
445
# Some negative testcases are omitted (already checked with HASH).
446
#------------------------------------------------------------------------
447
# 2.1.1 Assign KEY partitioning
448
ALTER TABLE t1 PARTITION BY KEY(f_int1);
449
SHOW CREATE TABLE t1;
451
t1 CREATE TABLE `t1` (
452
`f_int1` int(11) DEFAULT NULL,
453
`f_int2` int(11) DEFAULT NULL,
454
`f_char1` char(20) DEFAULT NULL,
455
`f_char2` char(20) DEFAULT NULL,
456
`f_charbig` varchar(1000) DEFAULT NULL
457
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) */
458
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
459
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
460
MYSQLTEST_VARDIR/master-data/test/t1.frm
461
MYSQLTEST_VARDIR/master-data/test/t1.par
462
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
463
id select_type table partitions type possible_keys key key_len ref rows Extra
464
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 Using where
465
# check read single success: 1
466
# check read all success: 1
467
# check read row by row success: 1
468
# 2.1.2 Add PARTITIONS not fitting to KEY --> must fail
469
ALTER TABLE t1 ADD PARTITION (PARTITION part1 VALUES IN (0));
470
ERROR HY000: Only LIST PARTITIONING can use VALUES IN in partition definition
471
ALTER TABLE t1 ADD PARTITION (PARTITION part2 VALUES LESS THAN (0));
472
ERROR HY000: Only RANGE PARTITIONING can use VALUES LESS THAN in partition definition
473
# 2.1.3 Add two named partitions + test
474
ALTER TABLE t1 ADD PARTITION (PARTITION part1, PARTITION part7);
475
SHOW CREATE TABLE t1;
477
t1 CREATE TABLE `t1` (
478
`f_int1` int(11) DEFAULT NULL,
479
`f_int2` int(11) DEFAULT NULL,
480
`f_char1` char(20) DEFAULT NULL,
481
`f_char2` char(20) DEFAULT NULL,
482
`f_charbig` varchar(1000) DEFAULT NULL
483
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM) */
484
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
485
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
486
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD
487
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI
488
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYD
489
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYI
490
MYSQLTEST_VARDIR/master-data/test/t1.frm
491
MYSQLTEST_VARDIR/master-data/test/t1.par
492
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
493
id select_type table partitions type possible_keys key key_len ref rows Extra
494
1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 7 Using where
495
# check read single success: 1
496
# check read all success: 1
497
# check read row by row success: 1
498
# 2.1.4 Add one named partition + test
499
ALTER TABLE t1 ADD PARTITION (PARTITION part2);
500
SHOW CREATE TABLE t1;
502
t1 CREATE TABLE `t1` (
503
`f_int1` int(11) DEFAULT NULL,
504
`f_int2` int(11) DEFAULT NULL,
505
`f_char1` char(20) DEFAULT NULL,
506
`f_char2` char(20) DEFAULT NULL,
507
`f_charbig` varchar(1000) DEFAULT NULL
508
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) */
509
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
510
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
511
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD
512
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI
513
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD
514
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI
515
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYD
516
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYI
517
MYSQLTEST_VARDIR/master-data/test/t1.frm
518
MYSQLTEST_VARDIR/master-data/test/t1.par
519
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
520
id select_type table partitions type possible_keys key key_len ref rows Extra
521
1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 5 Using where
522
# check read single success: 1
523
# check read all success: 1
524
# check read row by row success: 1
525
# 2.1.5 Add four not named partitions + test
526
ALTER TABLE t1 ADD PARTITION PARTITIONS 4;
527
SHOW CREATE TABLE t1;
529
t1 CREATE TABLE `t1` (
530
`f_int1` int(11) DEFAULT NULL,
531
`f_int2` int(11) DEFAULT NULL,
532
`f_char1` char(20) DEFAULT NULL,
533
`f_char2` char(20) DEFAULT NULL,
534
`f_charbig` varchar(1000) DEFAULT NULL
535
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM, PARTITION p4 ENGINE = MyISAM, PARTITION p5 ENGINE = MyISAM, PARTITION p6 ENGINE = MyISAM, PARTITION p7 ENGINE = MyISAM) */
536
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
537
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
538
MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD
539
MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI
540
MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYD
541
MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYI
542
MYSQLTEST_VARDIR/master-data/test/t1#P#p6.MYD
543
MYSQLTEST_VARDIR/master-data/test/t1#P#p6.MYI
544
MYSQLTEST_VARDIR/master-data/test/t1#P#p7.MYD
545
MYSQLTEST_VARDIR/master-data/test/t1#P#p7.MYI
546
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD
547
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI
548
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD
549
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI
550
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYD
551
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYI
552
MYSQLTEST_VARDIR/master-data/test/t1.frm
553
MYSQLTEST_VARDIR/master-data/test/t1.par
554
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
555
id select_type table partitions type possible_keys key key_len ref rows Extra
556
1 SIMPLE t1 p6 ALL NULL NULL NULL NULL 3 Using where
557
# check read single success: 1
558
# check read all success: 1
559
# check read row by row success: 1
560
#------------------------------------------------------------------------
561
# 2.2 Decrease number of PARTITIONS
562
# Some negative testcases are omitted (already checked with HASH).
563
#------------------------------------------------------------------------
564
# 2.2.1 DROP PARTITION is not supported for KEY --> must fail
565
ALTER TABLE t1 DROP PARTITION part1;
566
ERROR HY000: DROP PARTITION can only be used on RANGE/LIST partitions
567
# 2.2.4 COALESCE one partition + test loop
568
ALTER TABLE t1 COALESCE PARTITION 1;
569
SHOW CREATE TABLE t1;
571
t1 CREATE TABLE `t1` (
572
`f_int1` int(11) DEFAULT NULL,
573
`f_int2` int(11) DEFAULT NULL,
574
`f_char1` char(20) DEFAULT NULL,
575
`f_char2` char(20) DEFAULT NULL,
576
`f_charbig` varchar(1000) DEFAULT NULL
577
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM, PARTITION p4 ENGINE = MyISAM, PARTITION p5 ENGINE = MyISAM, PARTITION p6 ENGINE = MyISAM) */
578
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
579
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
580
MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD
581
MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI
582
MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYD
583
MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYI
584
MYSQLTEST_VARDIR/master-data/test/t1#P#p6.MYD
585
MYSQLTEST_VARDIR/master-data/test/t1#P#p6.MYI
586
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD
587
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI
588
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD
589
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI
590
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYD
591
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYI
592
MYSQLTEST_VARDIR/master-data/test/t1.frm
593
MYSQLTEST_VARDIR/master-data/test/t1.par
594
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
595
id select_type table partitions type possible_keys key key_len ref rows Extra
596
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 4 Using where
597
# check read single success: 1
598
# check read all success: 1
599
# check read row by row success: 1
600
ALTER TABLE t1 COALESCE PARTITION 1;
601
SHOW CREATE TABLE t1;
603
t1 CREATE TABLE `t1` (
604
`f_int1` int(11) DEFAULT NULL,
605
`f_int2` int(11) DEFAULT NULL,
606
`f_char1` char(20) DEFAULT NULL,
607
`f_char2` char(20) DEFAULT NULL,
608
`f_charbig` varchar(1000) DEFAULT NULL
609
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM, PARTITION p4 ENGINE = MyISAM, PARTITION p5 ENGINE = MyISAM) */
610
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
611
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
612
MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD
613
MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI
614
MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYD
615
MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYI
616
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD
617
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI
618
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD
619
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI
620
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYD
621
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYI
622
MYSQLTEST_VARDIR/master-data/test/t1.frm
623
MYSQLTEST_VARDIR/master-data/test/t1.par
624
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
625
id select_type table partitions type possible_keys key key_len ref rows Extra
626
1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 3 Using where
627
# check read single success: 1
628
# check read all success: 1
629
# check read row by row success: 1
630
ALTER TABLE t1 COALESCE PARTITION 1;
631
SHOW CREATE TABLE t1;
633
t1 CREATE TABLE `t1` (
634
`f_int1` int(11) DEFAULT NULL,
635
`f_int2` int(11) DEFAULT NULL,
636
`f_char1` char(20) DEFAULT NULL,
637
`f_char2` char(20) DEFAULT NULL,
638
`f_charbig` varchar(1000) DEFAULT NULL
639
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM, PARTITION p4 ENGINE = MyISAM) */
640
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
641
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
642
MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD
643
MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI
644
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD
645
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI
646
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD
647
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI
648
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYD
649
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYI
650
MYSQLTEST_VARDIR/master-data/test/t1.frm
651
MYSQLTEST_VARDIR/master-data/test/t1.par
652
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
653
id select_type table partitions type possible_keys key key_len ref rows Extra
654
1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 10 Using where
655
# check read single success: 1
656
# check read all success: 1
657
# check read row by row success: 1
658
ALTER TABLE t1 COALESCE PARTITION 1;
659
SHOW CREATE TABLE t1;
661
t1 CREATE TABLE `t1` (
662
`f_int1` int(11) DEFAULT NULL,
663
`f_int2` int(11) DEFAULT NULL,
664
`f_char1` char(20) DEFAULT NULL,
665
`f_char2` char(20) DEFAULT NULL,
666
`f_charbig` varchar(1000) DEFAULT NULL
667
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) */
668
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
669
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
670
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD
671
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI
672
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD
673
MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI
674
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYD
675
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYI
676
MYSQLTEST_VARDIR/master-data/test/t1.frm
677
MYSQLTEST_VARDIR/master-data/test/t1.par
678
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
679
id select_type table partitions type possible_keys key key_len ref rows Extra
680
1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 5 Using where
681
# check read single success: 1
682
# check read all success: 1
683
# check read row by row success: 1
684
ALTER TABLE t1 COALESCE PARTITION 1;
685
SHOW CREATE TABLE t1;
687
t1 CREATE TABLE `t1` (
688
`f_int1` int(11) DEFAULT NULL,
689
`f_int2` int(11) DEFAULT NULL,
690
`f_char1` char(20) DEFAULT NULL,
691
`f_char2` char(20) DEFAULT NULL,
692
`f_charbig` varchar(1000) DEFAULT NULL
693
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM) */
694
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
695
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
696
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD
697
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI
698
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYD
699
MYSQLTEST_VARDIR/master-data/test/t1#P#part7.MYI
700
MYSQLTEST_VARDIR/master-data/test/t1.frm
701
MYSQLTEST_VARDIR/master-data/test/t1.par
702
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
703
id select_type table partitions type possible_keys key key_len ref rows Extra
704
1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 7 Using where
705
# check read single success: 1
706
# check read all success: 1
707
# check read row by row success: 1
708
ALTER TABLE t1 COALESCE PARTITION 1;
709
SHOW CREATE TABLE t1;
711
t1 CREATE TABLE `t1` (
712
`f_int1` int(11) DEFAULT NULL,
713
`f_int2` int(11) DEFAULT NULL,
714
`f_char1` char(20) DEFAULT NULL,
715
`f_char2` char(20) DEFAULT NULL,
716
`f_charbig` varchar(1000) DEFAULT NULL
717
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM) */
718
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
719
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
720
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD
721
MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI
722
MYSQLTEST_VARDIR/master-data/test/t1.frm
723
MYSQLTEST_VARDIR/master-data/test/t1.par
724
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
725
id select_type table partitions type possible_keys key key_len ref rows Extra
726
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 10 Using where
727
# check read single success: 1
728
# check read all success: 1
729
# check read row by row success: 1
730
ALTER TABLE t1 COALESCE PARTITION 1;
731
SHOW CREATE TABLE t1;
733
t1 CREATE TABLE `t1` (
734
`f_int1` int(11) DEFAULT NULL,
735
`f_int2` int(11) DEFAULT NULL,
736
`f_char1` char(20) DEFAULT NULL,
737
`f_char2` char(20) DEFAULT NULL,
738
`f_charbig` varchar(1000) DEFAULT NULL
739
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = MyISAM) */
740
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
741
MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
742
MYSQLTEST_VARDIR/master-data/test/t1.frm
743
MYSQLTEST_VARDIR/master-data/test/t1.par
744
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
745
id select_type table partitions type possible_keys key key_len ref rows Extra
746
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 Using where
747
# check read single success: 1
748
# check read all success: 1
749
# check read row by row success: 1
750
# 2.2.5 COALESCE of last partition --> must fail
751
ALTER TABLE t1 COALESCE PARTITION 1;
752
ERROR HY000: Cannot remove all partitions, use DROP TABLE instead
753
# 2.2.6 Remove partitioning
754
ALTER TABLE t1 REMOVE PARTITIONING;
755
SHOW CREATE TABLE t1;
757
t1 CREATE TABLE `t1` (
758
`f_int1` int(11) DEFAULT NULL,
759
`f_int2` int(11) DEFAULT NULL,
760
`f_char1` char(20) DEFAULT NULL,
761
`f_char2` char(20) DEFAULT NULL,
762
`f_charbig` varchar(1000) DEFAULT NULL
763
) ENGINE=MyISAM DEFAULT CHARSET=latin1
764
MYSQLTEST_VARDIR/master-data/test/t1.MYD
765
MYSQLTEST_VARDIR/master-data/test/t1.MYI
766
MYSQLTEST_VARDIR/master-data/test/t1.frm
767
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
768
id select_type table partitions type possible_keys key key_len ref rows Extra
769
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using where
770
# check read single success: 1
771
# check read all success: 1
772
# check read row by row success: 1
773
# 2.2.7 Remove partitioning from not partitioned table --> ????
774
ALTER TABLE t1 REMOVE PARTITIONING;
776
DROP VIEW IF EXISTS v1;
777
DROP TABLE IF EXISTS t1;
778
DROP TABLE IF EXISTS t0_aux;
779
DROP TABLE IF EXISTS t0_definition;
780
DROP TABLE IF EXISTS t0_template;