~stewart/drizzle/embedded-innodb-create-select-transaction-arrgh

« back to all changes in this revision

Viewing changes to mysql-test/suite/parts/r/part_supported_sql_func_myisam.result

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-------------------------------------------------------------------------
 
2
---  abs(col1)  in partition with coltype  int
 
3
-------------------------------------------------------------------------
 
4
drop table if exists t1 ;
 
5
drop table if exists t2 ;
 
6
drop table if exists t3 ;
 
7
drop table if exists t4 ;
 
8
drop table if exists t5 ;
 
9
drop table if exists t6 ;
 
10
-------------------------------------------------------------------------
 
11
---  Create tables with abs(col1)
 
12
-------------------------------------------------------------------------
 
13
create table t1 (col1 int) engine='MYISAM' 
 
14
partition by range(abs(col1)) 
 
15
(partition p0 values less than (15),
 
16
partition p1 values less than maxvalue);
 
17
create table t2 (col1 int) engine='MYISAM' 
 
18
partition by list(abs(col1)) 
 
19
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
20
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
21
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
22
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
23
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
24
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
25
);
 
26
create table t3 (col1 int) engine='MYISAM' 
 
27
partition by hash(abs(col1));
 
28
create table t4 (colint int, col1 int) engine='MYISAM' 
 
29
partition by range(colint) 
 
30
subpartition by hash(abs(col1)) subpartitions 2 
 
31
(partition p0 values less than (15),
 
32
partition p1 values less than maxvalue);
 
33
create table t5 (colint int, col1 int) engine='MYISAM' 
 
34
partition by list(colint)
 
35
subpartition by hash(abs(col1)) subpartitions 2 
 
36
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
37
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
38
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
39
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
40
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
41
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
42
);
 
43
create table t6 (colint int, col1 int) engine='MYISAM' 
 
44
partition by range(colint) 
 
45
(partition p0 values less than (abs(15)),
 
46
partition p1 values less than maxvalue);
 
47
-------------------------------------------------------------------------
 
48
---  Access tables with abs(col1) 
 
49
-------------------------------------------------------------------------
 
50
insert into t1 values (5 );
 
51
insert into t1 values (13 );
 
52
insert into t2 values (5 );
 
53
insert into t2 values (13 );
 
54
insert into t2 values (17 );
 
55
insert into t3 values (5 );
 
56
insert into t3 values (13 );
 
57
insert into t3 values (17 );
 
58
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t4;
 
59
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t5;
 
60
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t6;
 
61
select abs(col1) from t1 order by col1;
 
62
abs(col1)
 
63
5
 
64
13
 
65
select * from t1 order by col1;
 
66
col1
 
67
5
 
68
13
 
69
select * from t2 order by col1;
 
70
col1
 
71
5
 
72
13
 
73
17
 
74
select * from t3 order by col1;
 
75
col1
 
76
5
 
77
13
 
78
17
 
79
select * from t4 order by colint;
 
80
colint  col1
 
81
1       5
 
82
2       13
 
83
3       15
 
84
4       17
 
85
5       23
 
86
6       34
 
87
7       56
 
88
8       56
 
89
9       45
 
90
10      34
 
91
11      78
 
92
12      89
 
93
13      67
 
94
14      46
 
95
15      34
 
96
16      324
 
97
17      345
 
98
18      34
 
99
19      78
 
100
20      567
 
101
21      4
 
102
22      435
 
103
23      34
 
104
24      45
 
105
25      4565
 
106
26      4
 
107
27      3
 
108
28      2
 
109
29      3
 
110
30      5
 
111
31      6
 
112
32      8
 
113
33      9
 
114
34      745
 
115
35      34
 
116
36      34
 
117
37      324
 
118
38      67
 
119
39      78
 
120
40      89
 
121
41      90
 
122
42      78967
 
123
50      56
 
124
51      34
 
125
55      123
 
126
select * from t5 order by colint;
 
127
colint  col1
 
128
1       5
 
129
2       13
 
130
3       15
 
131
4       17
 
132
5       23
 
133
6       34
 
134
7       56
 
135
8       56
 
136
9       45
 
137
10      34
 
138
11      78
 
139
12      89
 
140
13      67
 
141
14      46
 
142
15      34
 
143
16      324
 
144
17      345
 
145
18      34
 
146
19      78
 
147
20      567
 
148
21      4
 
149
22      435
 
150
23      34
 
151
24      45
 
152
25      4565
 
153
26      4
 
154
27      3
 
155
28      2
 
156
29      3
 
157
30      5
 
158
31      6
 
159
32      8
 
160
33      9
 
161
34      745
 
162
35      34
 
163
36      34
 
164
37      324
 
165
38      67
 
166
39      78
 
167
40      89
 
168
41      90
 
169
42      78967
 
170
50      56
 
171
51      34
 
172
55      123
 
173
select * from t6 order by colint;
 
174
colint  col1
 
175
1       5
 
176
2       13
 
177
3       15
 
178
4       17
 
179
5       23
 
180
6       34
 
181
7       56
 
182
8       56
 
183
9       45
 
184
10      34
 
185
11      78
 
186
12      89
 
187
13      67
 
188
14      46
 
189
15      34
 
190
16      324
 
191
17      345
 
192
18      34
 
193
19      78
 
194
20      567
 
195
21      4
 
196
22      435
 
197
23      34
 
198
24      45
 
199
25      4565
 
200
26      4
 
201
27      3
 
202
28      2
 
203
29      3
 
204
30      5
 
205
31      6
 
206
32      8
 
207
33      9
 
208
34      745
 
209
35      34
 
210
36      34
 
211
37      324
 
212
38      67
 
213
39      78
 
214
40      89
 
215
41      90
 
216
42      78967
 
217
50      56
 
218
51      34
 
219
55      123
 
220
update t1 set col1=15  where col1=5 ;
 
221
update t2 set col1=15  where col1=5 ;
 
222
update t3 set col1=15  where col1=5 ;
 
223
update t4 set col1=15  where col1=5 ;
 
224
update t5 set col1=15  where col1=5 ;
 
225
update t6 set col1=15  where col1=5 ;
 
226
select * from t1 order by col1;
 
227
col1
 
228
13
 
229
15
 
230
select * from t2 order by col1;
 
231
col1
 
232
13
 
233
15
 
234
17
 
235
select * from t3 order by col1;
 
236
col1
 
237
13
 
238
15
 
239
17
 
240
select * from t4 order by colint;
 
241
colint  col1
 
242
1       15
 
243
2       13
 
244
3       15
 
245
4       17
 
246
5       23
 
247
6       34
 
248
7       56
 
249
8       56
 
250
9       45
 
251
10      34
 
252
11      78
 
253
12      89
 
254
13      67
 
255
14      46
 
256
15      34
 
257
16      324
 
258
17      345
 
259
18      34
 
260
19      78
 
261
20      567
 
262
21      4
 
263
22      435
 
264
23      34
 
265
24      45
 
266
25      4565
 
267
26      4
 
268
27      3
 
269
28      2
 
270
29      3
 
271
30      15
 
272
31      6
 
273
32      8
 
274
33      9
 
275
34      745
 
276
35      34
 
277
36      34
 
278
37      324
 
279
38      67
 
280
39      78
 
281
40      89
 
282
41      90
 
283
42      78967
 
284
50      56
 
285
51      34
 
286
55      123
 
287
select * from t5 order by colint;
 
288
colint  col1
 
289
1       15
 
290
2       13
 
291
3       15
 
292
4       17
 
293
5       23
 
294
6       34
 
295
7       56
 
296
8       56
 
297
9       45
 
298
10      34
 
299
11      78
 
300
12      89
 
301
13      67
 
302
14      46
 
303
15      34
 
304
16      324
 
305
17      345
 
306
18      34
 
307
19      78
 
308
20      567
 
309
21      4
 
310
22      435
 
311
23      34
 
312
24      45
 
313
25      4565
 
314
26      4
 
315
27      3
 
316
28      2
 
317
29      3
 
318
30      15
 
319
31      6
 
320
32      8
 
321
33      9
 
322
34      745
 
323
35      34
 
324
36      34
 
325
37      324
 
326
38      67
 
327
39      78
 
328
40      89
 
329
41      90
 
330
42      78967
 
331
50      56
 
332
51      34
 
333
55      123
 
334
select * from t6 order by colint;
 
335
colint  col1
 
336
1       15
 
337
2       13
 
338
3       15
 
339
4       17
 
340
5       23
 
341
6       34
 
342
7       56
 
343
8       56
 
344
9       45
 
345
10      34
 
346
11      78
 
347
12      89
 
348
13      67
 
349
14      46
 
350
15      34
 
351
16      324
 
352
17      345
 
353
18      34
 
354
19      78
 
355
20      567
 
356
21      4
 
357
22      435
 
358
23      34
 
359
24      45
 
360
25      4565
 
361
26      4
 
362
27      3
 
363
28      2
 
364
29      3
 
365
30      15
 
366
31      6
 
367
32      8
 
368
33      9
 
369
34      745
 
370
35      34
 
371
36      34
 
372
37      324
 
373
38      67
 
374
39      78
 
375
40      89
 
376
41      90
 
377
42      78967
 
378
50      56
 
379
51      34
 
380
55      123
 
381
-------------------------------------------------------------------------
 
382
---  Alter tables with abs(col1)
 
383
-------------------------------------------------------------------------
 
384
drop table if exists t11 ;
 
385
drop table if exists t22 ;
 
386
drop table if exists t33 ;
 
387
drop table if exists t44 ;
 
388
drop table if exists t55 ;
 
389
drop table if exists t66 ;
 
390
create table t11 engine='MYISAM' as select * from t1;
 
391
create table t22 engine='MYISAM' as select * from t2;
 
392
create table t33 engine='MYISAM' as select * from t3;
 
393
create table t44 engine='MYISAM' as select * from t4;
 
394
create table t55 engine='MYISAM' as select * from t5;
 
395
create table t66 engine='MYISAM' as select * from t6;
 
396
alter table t11
 
397
partition by range(abs(col1)) 
 
398
(partition p0 values less than (15),
 
399
partition p1 values less than maxvalue);
 
400
alter table t22
 
401
partition by list(abs(col1)) 
 
402
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
403
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
404
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
405
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
406
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
407
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
408
);
 
409
alter table t33
 
410
partition by hash(abs(col1));
 
411
alter table t44
 
412
partition by range(colint) 
 
413
subpartition by hash(abs(col1)) subpartitions 2 
 
414
(partition p0 values less than (15),
 
415
partition p1 values less than maxvalue);
 
416
alter table t55
 
417
partition by list(colint)
 
418
subpartition by hash(abs(col1)) subpartitions 2 
 
419
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
420
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
421
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
422
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
423
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
424
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
425
);
 
426
alter table t66
 
427
partition by range(colint) 
 
428
(partition p0 values less than (abs(15)),
 
429
partition p1 values less than maxvalue);
 
430
select * from t11 order by col1;
 
431
col1
 
432
13
 
433
15
 
434
select * from t22 order by col1;
 
435
col1
 
436
13
 
437
15
 
438
17
 
439
select * from t33 order by col1;
 
440
col1
 
441
13
 
442
15
 
443
17
 
444
select * from t44 order by colint;
 
445
colint  col1
 
446
1       15
 
447
2       13
 
448
3       15
 
449
4       17
 
450
5       23
 
451
6       34
 
452
7       56
 
453
8       56
 
454
9       45
 
455
10      34
 
456
11      78
 
457
12      89
 
458
13      67
 
459
14      46
 
460
15      34
 
461
16      324
 
462
17      345
 
463
18      34
 
464
19      78
 
465
20      567
 
466
21      4
 
467
22      435
 
468
23      34
 
469
24      45
 
470
25      4565
 
471
26      4
 
472
27      3
 
473
28      2
 
474
29      3
 
475
30      15
 
476
31      6
 
477
32      8
 
478
33      9
 
479
34      745
 
480
35      34
 
481
36      34
 
482
37      324
 
483
38      67
 
484
39      78
 
485
40      89
 
486
41      90
 
487
42      78967
 
488
50      56
 
489
51      34
 
490
55      123
 
491
select * from t55 order by colint;
 
492
colint  col1
 
493
1       15
 
494
2       13
 
495
3       15
 
496
4       17
 
497
5       23
 
498
6       34
 
499
7       56
 
500
8       56
 
501
9       45
 
502
10      34
 
503
11      78
 
504
12      89
 
505
13      67
 
506
14      46
 
507
15      34
 
508
16      324
 
509
17      345
 
510
18      34
 
511
19      78
 
512
20      567
 
513
21      4
 
514
22      435
 
515
23      34
 
516
24      45
 
517
25      4565
 
518
26      4
 
519
27      3
 
520
28      2
 
521
29      3
 
522
30      15
 
523
31      6
 
524
32      8
 
525
33      9
 
526
34      745
 
527
35      34
 
528
36      34
 
529
37      324
 
530
38      67
 
531
39      78
 
532
40      89
 
533
41      90
 
534
42      78967
 
535
50      56
 
536
51      34
 
537
55      123
 
538
select * from t66 order by colint;
 
539
colint  col1
 
540
1       15
 
541
2       13
 
542
3       15
 
543
4       17
 
544
5       23
 
545
6       34
 
546
7       56
 
547
8       56
 
548
9       45
 
549
10      34
 
550
11      78
 
551
12      89
 
552
13      67
 
553
14      46
 
554
15      34
 
555
16      324
 
556
17      345
 
557
18      34
 
558
19      78
 
559
20      567
 
560
21      4
 
561
22      435
 
562
23      34
 
563
24      45
 
564
25      4565
 
565
26      4
 
566
27      3
 
567
28      2
 
568
29      3
 
569
30      15
 
570
31      6
 
571
32      8
 
572
33      9
 
573
34      745
 
574
35      34
 
575
36      34
 
576
37      324
 
577
38      67
 
578
39      78
 
579
40      89
 
580
41      90
 
581
42      78967
 
582
50      56
 
583
51      34
 
584
55      123
 
585
---------------------------
 
586
---- some alter table begin
 
587
---------------------------
 
588
alter table t11
 
589
reorganize partition p0,p1 into
 
590
(partition s1 values less than maxvalue);
 
591
select * from t11 order by col1;
 
592
col1
 
593
13
 
594
15
 
595
alter table t11
 
596
reorganize partition s1 into
 
597
(partition p0 values less than (15),
 
598
partition p1 values less than maxvalue);
 
599
select * from t11 order by col1;
 
600
col1
 
601
13
 
602
15
 
603
alter table t55
 
604
partition by list(colint)
 
605
subpartition by hash(abs(col1)) subpartitions 5 
 
606
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
607
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
608
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
609
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
610
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
611
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
612
);
 
613
show create table t55;
 
614
Table   Create Table
 
615
t55     CREATE TABLE `t55` (
 
616
  `colint` int(11) DEFAULT NULL,
 
617
  `col1` int(11) DEFAULT NULL
 
618
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (abs(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
 
619
select * from t55 order by colint;
 
620
colint  col1
 
621
1       15
 
622
2       13
 
623
3       15
 
624
4       17
 
625
5       23
 
626
6       34
 
627
7       56
 
628
8       56
 
629
9       45
 
630
10      34
 
631
11      78
 
632
12      89
 
633
13      67
 
634
14      46
 
635
15      34
 
636
16      324
 
637
17      345
 
638
18      34
 
639
19      78
 
640
20      567
 
641
21      4
 
642
22      435
 
643
23      34
 
644
24      45
 
645
25      4565
 
646
26      4
 
647
27      3
 
648
28      2
 
649
29      3
 
650
30      15
 
651
31      6
 
652
32      8
 
653
33      9
 
654
34      745
 
655
35      34
 
656
36      34
 
657
37      324
 
658
38      67
 
659
39      78
 
660
40      89
 
661
41      90
 
662
42      78967
 
663
50      56
 
664
51      34
 
665
55      123
 
666
alter table t66
 
667
reorganize partition p0,p1 into
 
668
(partition s1 values less than maxvalue);
 
669
select * from t66 order by colint;
 
670
colint  col1
 
671
1       15
 
672
2       13
 
673
3       15
 
674
4       17
 
675
5       23
 
676
6       34
 
677
7       56
 
678
8       56
 
679
9       45
 
680
10      34
 
681
11      78
 
682
12      89
 
683
13      67
 
684
14      46
 
685
15      34
 
686
16      324
 
687
17      345
 
688
18      34
 
689
19      78
 
690
20      567
 
691
21      4
 
692
22      435
 
693
23      34
 
694
24      45
 
695
25      4565
 
696
26      4
 
697
27      3
 
698
28      2
 
699
29      3
 
700
30      15
 
701
31      6
 
702
32      8
 
703
33      9
 
704
34      745
 
705
35      34
 
706
36      34
 
707
37      324
 
708
38      67
 
709
39      78
 
710
40      89
 
711
41      90
 
712
42      78967
 
713
50      56
 
714
51      34
 
715
55      123
 
716
alter table t66
 
717
reorganize partition s1 into
 
718
(partition p0 values less than (abs(15)),
 
719
partition p1 values less than maxvalue);
 
720
select * from t66 order by colint;
 
721
colint  col1
 
722
1       15
 
723
2       13
 
724
3       15
 
725
4       17
 
726
5       23
 
727
6       34
 
728
7       56
 
729
8       56
 
730
9       45
 
731
10      34
 
732
11      78
 
733
12      89
 
734
13      67
 
735
14      46
 
736
15      34
 
737
16      324
 
738
17      345
 
739
18      34
 
740
19      78
 
741
20      567
 
742
21      4
 
743
22      435
 
744
23      34
 
745
24      45
 
746
25      4565
 
747
26      4
 
748
27      3
 
749
28      2
 
750
29      3
 
751
30      15
 
752
31      6
 
753
32      8
 
754
33      9
 
755
34      745
 
756
35      34
 
757
36      34
 
758
37      324
 
759
38      67
 
760
39      78
 
761
40      89
 
762
41      90
 
763
42      78967
 
764
50      56
 
765
51      34
 
766
55      123
 
767
alter table t66
 
768
reorganize partition p0,p1 into
 
769
(partition s1 values less than maxvalue);
 
770
select * from t66 order by colint;
 
771
colint  col1
 
772
1       15
 
773
2       13
 
774
3       15
 
775
4       17
 
776
5       23
 
777
6       34
 
778
7       56
 
779
8       56
 
780
9       45
 
781
10      34
 
782
11      78
 
783
12      89
 
784
13      67
 
785
14      46
 
786
15      34
 
787
16      324
 
788
17      345
 
789
18      34
 
790
19      78
 
791
20      567
 
792
21      4
 
793
22      435
 
794
23      34
 
795
24      45
 
796
25      4565
 
797
26      4
 
798
27      3
 
799
28      2
 
800
29      3
 
801
30      15
 
802
31      6
 
803
32      8
 
804
33      9
 
805
34      745
 
806
35      34
 
807
36      34
 
808
37      324
 
809
38      67
 
810
39      78
 
811
40      89
 
812
41      90
 
813
42      78967
 
814
50      56
 
815
51      34
 
816
55      123
 
817
alter table t66
 
818
reorganize partition s1 into
 
819
(partition p0 values less than (abs(15)),
 
820
partition p1 values less than maxvalue);
 
821
select * from t66 order by colint;
 
822
colint  col1
 
823
1       15
 
824
2       13
 
825
3       15
 
826
4       17
 
827
5       23
 
828
6       34
 
829
7       56
 
830
8       56
 
831
9       45
 
832
10      34
 
833
11      78
 
834
12      89
 
835
13      67
 
836
14      46
 
837
15      34
 
838
16      324
 
839
17      345
 
840
18      34
 
841
19      78
 
842
20      567
 
843
21      4
 
844
22      435
 
845
23      34
 
846
24      45
 
847
25      4565
 
848
26      4
 
849
27      3
 
850
28      2
 
851
29      3
 
852
30      15
 
853
31      6
 
854
32      8
 
855
33      9
 
856
34      745
 
857
35      34
 
858
36      34
 
859
37      324
 
860
38      67
 
861
39      78
 
862
40      89
 
863
41      90
 
864
42      78967
 
865
50      56
 
866
51      34
 
867
55      123
 
868
-------------------------------------------------------------------------
 
869
---  Delete rows and partitions of tables with abs(col1)
 
870
-------------------------------------------------------------------------
 
871
delete from t1 where col1=13 ;
 
872
delete from t2 where col1=13 ;
 
873
delete from t3 where col1=13 ;
 
874
delete from t4 where col1=13 ;
 
875
delete from t5 where col1=13 ;
 
876
delete from t6 where col1=13 ;
 
877
select * from t1 order by col1;
 
878
col1
 
879
15
 
880
select * from t2 order by col1;
 
881
col1
 
882
15
 
883
17
 
884
select * from t3 order by col1;
 
885
col1
 
886
15
 
887
17
 
888
select * from t4 order by colint;
 
889
colint  col1
 
890
1       15
 
891
3       15
 
892
4       17
 
893
5       23
 
894
6       34
 
895
7       56
 
896
8       56
 
897
9       45
 
898
10      34
 
899
11      78
 
900
12      89
 
901
13      67
 
902
14      46
 
903
15      34
 
904
16      324
 
905
17      345
 
906
18      34
 
907
19      78
 
908
20      567
 
909
21      4
 
910
22      435
 
911
23      34
 
912
24      45
 
913
25      4565
 
914
26      4
 
915
27      3
 
916
28      2
 
917
29      3
 
918
30      15
 
919
31      6
 
920
32      8
 
921
33      9
 
922
34      745
 
923
35      34
 
924
36      34
 
925
37      324
 
926
38      67
 
927
39      78
 
928
40      89
 
929
41      90
 
930
42      78967
 
931
50      56
 
932
51      34
 
933
55      123
 
934
select * from t5 order by colint;
 
935
colint  col1
 
936
1       15
 
937
3       15
 
938
4       17
 
939
5       23
 
940
6       34
 
941
7       56
 
942
8       56
 
943
9       45
 
944
10      34
 
945
11      78
 
946
12      89
 
947
13      67
 
948
14      46
 
949
15      34
 
950
16      324
 
951
17      345
 
952
18      34
 
953
19      78
 
954
20      567
 
955
21      4
 
956
22      435
 
957
23      34
 
958
24      45
 
959
25      4565
 
960
26      4
 
961
27      3
 
962
28      2
 
963
29      3
 
964
30      15
 
965
31      6
 
966
32      8
 
967
33      9
 
968
34      745
 
969
35      34
 
970
36      34
 
971
37      324
 
972
38      67
 
973
39      78
 
974
40      89
 
975
41      90
 
976
42      78967
 
977
50      56
 
978
51      34
 
979
55      123
 
980
insert into t1 values (13 );
 
981
insert into t2 values (13 );
 
982
insert into t3 values (13 );
 
983
insert into t4 values (60,13 );
 
984
insert into t5 values (60,13 );
 
985
insert into t6 values (60,13 );
 
986
select * from t1 order by col1;
 
987
col1
 
988
13
 
989
15
 
990
select * from t2 order by col1;
 
991
col1
 
992
13
 
993
15
 
994
17
 
995
select * from t3 order by col1;
 
996
col1
 
997
13
 
998
15
 
999
17
 
1000
select * from t4 order by colint;
 
1001
colint  col1
 
1002
1       15
 
1003
3       15
 
1004
4       17
 
1005
5       23
 
1006
6       34
 
1007
7       56
 
1008
8       56
 
1009
9       45
 
1010
10      34
 
1011
11      78
 
1012
12      89
 
1013
13      67
 
1014
14      46
 
1015
15      34
 
1016
16      324
 
1017
17      345
 
1018
18      34
 
1019
19      78
 
1020
20      567
 
1021
21      4
 
1022
22      435
 
1023
23      34
 
1024
24      45
 
1025
25      4565
 
1026
26      4
 
1027
27      3
 
1028
28      2
 
1029
29      3
 
1030
30      15
 
1031
31      6
 
1032
32      8
 
1033
33      9
 
1034
34      745
 
1035
35      34
 
1036
36      34
 
1037
37      324
 
1038
38      67
 
1039
39      78
 
1040
40      89
 
1041
41      90
 
1042
42      78967
 
1043
50      56
 
1044
51      34
 
1045
55      123
 
1046
60      13
 
1047
select * from t5 order by colint;
 
1048
colint  col1
 
1049
1       15
 
1050
3       15
 
1051
4       17
 
1052
5       23
 
1053
6       34
 
1054
7       56
 
1055
8       56
 
1056
9       45
 
1057
10      34
 
1058
11      78
 
1059
12      89
 
1060
13      67
 
1061
14      46
 
1062
15      34
 
1063
16      324
 
1064
17      345
 
1065
18      34
 
1066
19      78
 
1067
20      567
 
1068
21      4
 
1069
22      435
 
1070
23      34
 
1071
24      45
 
1072
25      4565
 
1073
26      4
 
1074
27      3
 
1075
28      2
 
1076
29      3
 
1077
30      15
 
1078
31      6
 
1079
32      8
 
1080
33      9
 
1081
34      745
 
1082
35      34
 
1083
36      34
 
1084
37      324
 
1085
38      67
 
1086
39      78
 
1087
40      89
 
1088
41      90
 
1089
42      78967
 
1090
50      56
 
1091
51      34
 
1092
55      123
 
1093
60      13
 
1094
select * from t6 order by colint;
 
1095
colint  col1
 
1096
1       15
 
1097
3       15
 
1098
4       17
 
1099
5       23
 
1100
6       34
 
1101
7       56
 
1102
8       56
 
1103
9       45
 
1104
10      34
 
1105
11      78
 
1106
12      89
 
1107
13      67
 
1108
14      46
 
1109
15      34
 
1110
16      324
 
1111
17      345
 
1112
18      34
 
1113
19      78
 
1114
20      567
 
1115
21      4
 
1116
22      435
 
1117
23      34
 
1118
24      45
 
1119
25      4565
 
1120
26      4
 
1121
27      3
 
1122
28      2
 
1123
29      3
 
1124
30      15
 
1125
31      6
 
1126
32      8
 
1127
33      9
 
1128
34      745
 
1129
35      34
 
1130
36      34
 
1131
37      324
 
1132
38      67
 
1133
39      78
 
1134
40      89
 
1135
41      90
 
1136
42      78967
 
1137
50      56
 
1138
51      34
 
1139
55      123
 
1140
60      13
 
1141
alter table t1 drop partition p0;
 
1142
alter table t2 drop partition p0;
 
1143
alter table t4 drop partition p0;
 
1144
alter table t5 drop partition p0;
 
1145
alter table t6 drop partition p0;
 
1146
select * from t1 order by col1;
 
1147
col1
 
1148
15
 
1149
select * from t2 order by col1;
 
1150
col1
 
1151
13
 
1152
15
 
1153
17
 
1154
select * from t3 order by col1;
 
1155
col1
 
1156
13
 
1157
15
 
1158
17
 
1159
select * from t4 order by colint;
 
1160
colint  col1
 
1161
15      34
 
1162
16      324
 
1163
17      345
 
1164
18      34
 
1165
19      78
 
1166
20      567
 
1167
21      4
 
1168
22      435
 
1169
23      34
 
1170
24      45
 
1171
25      4565
 
1172
26      4
 
1173
27      3
 
1174
28      2
 
1175
29      3
 
1176
30      15
 
1177
31      6
 
1178
32      8
 
1179
33      9
 
1180
34      745
 
1181
35      34
 
1182
36      34
 
1183
37      324
 
1184
38      67
 
1185
39      78
 
1186
40      89
 
1187
41      90
 
1188
42      78967
 
1189
50      56
 
1190
51      34
 
1191
55      123
 
1192
60      13
 
1193
select * from t5 order by colint;
 
1194
colint  col1
 
1195
11      78
 
1196
12      89
 
1197
13      67
 
1198
14      46
 
1199
15      34
 
1200
16      324
 
1201
17      345
 
1202
18      34
 
1203
19      78
 
1204
20      567
 
1205
21      4
 
1206
22      435
 
1207
23      34
 
1208
24      45
 
1209
25      4565
 
1210
26      4
 
1211
27      3
 
1212
28      2
 
1213
29      3
 
1214
30      15
 
1215
31      6
 
1216
32      8
 
1217
33      9
 
1218
34      745
 
1219
35      34
 
1220
36      34
 
1221
37      324
 
1222
38      67
 
1223
39      78
 
1224
40      89
 
1225
41      90
 
1226
42      78967
 
1227
50      56
 
1228
51      34
 
1229
55      123
 
1230
60      13
 
1231
select * from t6 order by colint;
 
1232
colint  col1
 
1233
15      34
 
1234
16      324
 
1235
17      345
 
1236
18      34
 
1237
19      78
 
1238
20      567
 
1239
21      4
 
1240
22      435
 
1241
23      34
 
1242
24      45
 
1243
25      4565
 
1244
26      4
 
1245
27      3
 
1246
28      2
 
1247
29      3
 
1248
30      15
 
1249
31      6
 
1250
32      8
 
1251
33      9
 
1252
34      745
 
1253
35      34
 
1254
36      34
 
1255
37      324
 
1256
38      67
 
1257
39      78
 
1258
40      89
 
1259
41      90
 
1260
42      78967
 
1261
50      56
 
1262
51      34
 
1263
55      123
 
1264
60      13
 
1265
-------------------------------------------------------------------------
 
1266
---  Delete rows and partitions of tables with abs(col1)
 
1267
-------------------------------------------------------------------------
 
1268
delete from t11 where col1=13 ;
 
1269
delete from t22 where col1=13 ;
 
1270
delete from t33 where col1=13 ;
 
1271
delete from t44 where col1=13 ;
 
1272
delete from t55 where col1=13 ;
 
1273
delete from t66 where col1=13 ;
 
1274
select * from t11 order by col1;
 
1275
col1
 
1276
15
 
1277
select * from t22 order by col1;
 
1278
col1
 
1279
15
 
1280
17
 
1281
select * from t33 order by col1;
 
1282
col1
 
1283
15
 
1284
17
 
1285
select * from t44 order by colint;
 
1286
colint  col1
 
1287
1       15
 
1288
3       15
 
1289
4       17
 
1290
5       23
 
1291
6       34
 
1292
7       56
 
1293
8       56
 
1294
9       45
 
1295
10      34
 
1296
11      78
 
1297
12      89
 
1298
13      67
 
1299
14      46
 
1300
15      34
 
1301
16      324
 
1302
17      345
 
1303
18      34
 
1304
19      78
 
1305
20      567
 
1306
21      4
 
1307
22      435
 
1308
23      34
 
1309
24      45
 
1310
25      4565
 
1311
26      4
 
1312
27      3
 
1313
28      2
 
1314
29      3
 
1315
30      15
 
1316
31      6
 
1317
32      8
 
1318
33      9
 
1319
34      745
 
1320
35      34
 
1321
36      34
 
1322
37      324
 
1323
38      67
 
1324
39      78
 
1325
40      89
 
1326
41      90
 
1327
42      78967
 
1328
50      56
 
1329
51      34
 
1330
55      123
 
1331
select * from t55 order by colint;
 
1332
colint  col1
 
1333
1       15
 
1334
3       15
 
1335
4       17
 
1336
5       23
 
1337
6       34
 
1338
7       56
 
1339
8       56
 
1340
9       45
 
1341
10      34
 
1342
11      78
 
1343
12      89
 
1344
13      67
 
1345
14      46
 
1346
15      34
 
1347
16      324
 
1348
17      345
 
1349
18      34
 
1350
19      78
 
1351
20      567
 
1352
21      4
 
1353
22      435
 
1354
23      34
 
1355
24      45
 
1356
25      4565
 
1357
26      4
 
1358
27      3
 
1359
28      2
 
1360
29      3
 
1361
30      15
 
1362
31      6
 
1363
32      8
 
1364
33      9
 
1365
34      745
 
1366
35      34
 
1367
36      34
 
1368
37      324
 
1369
38      67
 
1370
39      78
 
1371
40      89
 
1372
41      90
 
1373
42      78967
 
1374
50      56
 
1375
51      34
 
1376
55      123
 
1377
insert into t11 values (13 );
 
1378
insert into t22 values (13 );
 
1379
insert into t33 values (13 );
 
1380
insert into t44 values (60,13 );
 
1381
insert into t55 values (60,13 );
 
1382
insert into t66 values (60,13 );
 
1383
select * from t11 order by col1;
 
1384
col1
 
1385
13
 
1386
15
 
1387
select * from t22 order by col1;
 
1388
col1
 
1389
13
 
1390
15
 
1391
17
 
1392
select * from t33 order by col1;
 
1393
col1
 
1394
13
 
1395
15
 
1396
17
 
1397
select * from t44 order by colint;
 
1398
colint  col1
 
1399
1       15
 
1400
3       15
 
1401
4       17
 
1402
5       23
 
1403
6       34
 
1404
7       56
 
1405
8       56
 
1406
9       45
 
1407
10      34
 
1408
11      78
 
1409
12      89
 
1410
13      67
 
1411
14      46
 
1412
15      34
 
1413
16      324
 
1414
17      345
 
1415
18      34
 
1416
19      78
 
1417
20      567
 
1418
21      4
 
1419
22      435
 
1420
23      34
 
1421
24      45
 
1422
25      4565
 
1423
26      4
 
1424
27      3
 
1425
28      2
 
1426
29      3
 
1427
30      15
 
1428
31      6
 
1429
32      8
 
1430
33      9
 
1431
34      745
 
1432
35      34
 
1433
36      34
 
1434
37      324
 
1435
38      67
 
1436
39      78
 
1437
40      89
 
1438
41      90
 
1439
42      78967
 
1440
50      56
 
1441
51      34
 
1442
55      123
 
1443
60      13
 
1444
select * from t55 order by colint;
 
1445
colint  col1
 
1446
1       15
 
1447
3       15
 
1448
4       17
 
1449
5       23
 
1450
6       34
 
1451
7       56
 
1452
8       56
 
1453
9       45
 
1454
10      34
 
1455
11      78
 
1456
12      89
 
1457
13      67
 
1458
14      46
 
1459
15      34
 
1460
16      324
 
1461
17      345
 
1462
18      34
 
1463
19      78
 
1464
20      567
 
1465
21      4
 
1466
22      435
 
1467
23      34
 
1468
24      45
 
1469
25      4565
 
1470
26      4
 
1471
27      3
 
1472
28      2
 
1473
29      3
 
1474
30      15
 
1475
31      6
 
1476
32      8
 
1477
33      9
 
1478
34      745
 
1479
35      34
 
1480
36      34
 
1481
37      324
 
1482
38      67
 
1483
39      78
 
1484
40      89
 
1485
41      90
 
1486
42      78967
 
1487
50      56
 
1488
51      34
 
1489
55      123
 
1490
60      13
 
1491
select * from t66 order by colint;
 
1492
colint  col1
 
1493
1       15
 
1494
3       15
 
1495
4       17
 
1496
5       23
 
1497
6       34
 
1498
7       56
 
1499
8       56
 
1500
9       45
 
1501
10      34
 
1502
11      78
 
1503
12      89
 
1504
13      67
 
1505
14      46
 
1506
15      34
 
1507
16      324
 
1508
17      345
 
1509
18      34
 
1510
19      78
 
1511
20      567
 
1512
21      4
 
1513
22      435
 
1514
23      34
 
1515
24      45
 
1516
25      4565
 
1517
26      4
 
1518
27      3
 
1519
28      2
 
1520
29      3
 
1521
30      15
 
1522
31      6
 
1523
32      8
 
1524
33      9
 
1525
34      745
 
1526
35      34
 
1527
36      34
 
1528
37      324
 
1529
38      67
 
1530
39      78
 
1531
40      89
 
1532
41      90
 
1533
42      78967
 
1534
50      56
 
1535
51      34
 
1536
55      123
 
1537
60      13
 
1538
alter table t11 drop partition p0;
 
1539
alter table t22 drop partition p0;
 
1540
alter table t44 drop partition p0;
 
1541
alter table t55 drop partition p0;
 
1542
alter table t66 drop partition p0;
 
1543
select * from t11 order by col1;
 
1544
col1
 
1545
15
 
1546
select * from t22 order by col1;
 
1547
col1
 
1548
13
 
1549
15
 
1550
17
 
1551
select * from t33 order by col1;
 
1552
col1
 
1553
13
 
1554
15
 
1555
17
 
1556
select * from t44 order by colint;
 
1557
colint  col1
 
1558
15      34
 
1559
16      324
 
1560
17      345
 
1561
18      34
 
1562
19      78
 
1563
20      567
 
1564
21      4
 
1565
22      435
 
1566
23      34
 
1567
24      45
 
1568
25      4565
 
1569
26      4
 
1570
27      3
 
1571
28      2
 
1572
29      3
 
1573
30      15
 
1574
31      6
 
1575
32      8
 
1576
33      9
 
1577
34      745
 
1578
35      34
 
1579
36      34
 
1580
37      324
 
1581
38      67
 
1582
39      78
 
1583
40      89
 
1584
41      90
 
1585
42      78967
 
1586
50      56
 
1587
51      34
 
1588
55      123
 
1589
60      13
 
1590
select * from t55 order by colint;
 
1591
colint  col1
 
1592
11      78
 
1593
12      89
 
1594
13      67
 
1595
14      46
 
1596
15      34
 
1597
16      324
 
1598
17      345
 
1599
18      34
 
1600
19      78
 
1601
20      567
 
1602
21      4
 
1603
22      435
 
1604
23      34
 
1605
24      45
 
1606
25      4565
 
1607
26      4
 
1608
27      3
 
1609
28      2
 
1610
29      3
 
1611
30      15
 
1612
31      6
 
1613
32      8
 
1614
33      9
 
1615
34      745
 
1616
35      34
 
1617
36      34
 
1618
37      324
 
1619
38      67
 
1620
39      78
 
1621
40      89
 
1622
41      90
 
1623
42      78967
 
1624
50      56
 
1625
51      34
 
1626
55      123
 
1627
60      13
 
1628
select * from t66 order by colint;
 
1629
colint  col1
 
1630
15      34
 
1631
16      324
 
1632
17      345
 
1633
18      34
 
1634
19      78
 
1635
20      567
 
1636
21      4
 
1637
22      435
 
1638
23      34
 
1639
24      45
 
1640
25      4565
 
1641
26      4
 
1642
27      3
 
1643
28      2
 
1644
29      3
 
1645
30      15
 
1646
31      6
 
1647
32      8
 
1648
33      9
 
1649
34      745
 
1650
35      34
 
1651
36      34
 
1652
37      324
 
1653
38      67
 
1654
39      78
 
1655
40      89
 
1656
41      90
 
1657
42      78967
 
1658
50      56
 
1659
51      34
 
1660
55      123
 
1661
60      13
 
1662
-------------------------
 
1663
---- some alter table end
 
1664
-------------------------
 
1665
drop table if exists t1 ;
 
1666
drop table if exists t2 ;
 
1667
drop table if exists t3 ;
 
1668
drop table if exists t4 ;
 
1669
drop table if exists t5 ;
 
1670
drop table if exists t6 ;
 
1671
drop table if exists t11 ;
 
1672
drop table if exists t22 ;
 
1673
drop table if exists t33 ;
 
1674
drop table if exists t44 ;
 
1675
drop table if exists t55 ;
 
1676
drop table if exists t66 ;
 
1677
-------------------------------------------------------------------------
 
1678
---  mod(col1,10)  in partition with coltype  int
 
1679
-------------------------------------------------------------------------
 
1680
drop table if exists t1 ;
 
1681
drop table if exists t2 ;
 
1682
drop table if exists t3 ;
 
1683
drop table if exists t4 ;
 
1684
drop table if exists t5 ;
 
1685
drop table if exists t6 ;
 
1686
-------------------------------------------------------------------------
 
1687
---  Create tables with mod(col1,10)
 
1688
-------------------------------------------------------------------------
 
1689
create table t1 (col1 int) engine='MYISAM' 
 
1690
partition by range(mod(col1,10)) 
 
1691
(partition p0 values less than (15),
 
1692
partition p1 values less than maxvalue);
 
1693
create table t2 (col1 int) engine='MYISAM' 
 
1694
partition by list(mod(col1,10)) 
 
1695
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
1696
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
1697
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
1698
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
1699
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
1700
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
1701
);
 
1702
create table t3 (col1 int) engine='MYISAM' 
 
1703
partition by hash(mod(col1,10));
 
1704
create table t4 (colint int, col1 int) engine='MYISAM' 
 
1705
partition by range(colint) 
 
1706
subpartition by hash(mod(col1,10)) subpartitions 2 
 
1707
(partition p0 values less than (15),
 
1708
partition p1 values less than maxvalue);
 
1709
create table t5 (colint int, col1 int) engine='MYISAM' 
 
1710
partition by list(colint)
 
1711
subpartition by hash(mod(col1,10)) subpartitions 2 
 
1712
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
1713
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
1714
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
1715
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
1716
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
1717
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
1718
);
 
1719
create table t6 (colint int, col1 int) engine='MYISAM' 
 
1720
partition by range(colint) 
 
1721
(partition p0 values less than (mod(15,10)),
 
1722
partition p1 values less than maxvalue);
 
1723
-------------------------------------------------------------------------
 
1724
---  Access tables with mod(col1,10) 
 
1725
-------------------------------------------------------------------------
 
1726
insert into t1 values (5);
 
1727
insert into t1 values (19);
 
1728
insert into t2 values (5);
 
1729
insert into t2 values (19);
 
1730
insert into t2 values (17);
 
1731
insert into t3 values (5);
 
1732
insert into t3 values (19);
 
1733
insert into t3 values (17);
 
1734
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t4;
 
1735
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t5;
 
1736
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t6;
 
1737
select mod(col1,10) from t1 order by col1;
 
1738
mod(col1,10)
 
1739
5
 
1740
9
 
1741
select * from t1 order by col1;
 
1742
col1
 
1743
5
 
1744
19
 
1745
select * from t2 order by col1;
 
1746
col1
 
1747
5
 
1748
17
 
1749
19
 
1750
select * from t3 order by col1;
 
1751
col1
 
1752
5
 
1753
17
 
1754
19
 
1755
select * from t4 order by colint;
 
1756
colint  col1
 
1757
1       5
 
1758
2       13
 
1759
3       15
 
1760
4       17
 
1761
5       23
 
1762
6       34
 
1763
7       56
 
1764
8       56
 
1765
9       45
 
1766
10      34
 
1767
11      78
 
1768
12      89
 
1769
13      67
 
1770
14      46
 
1771
15      34
 
1772
16      324
 
1773
17      345
 
1774
18      34
 
1775
19      78
 
1776
20      567
 
1777
21      4
 
1778
22      435
 
1779
23      34
 
1780
24      45
 
1781
25      4565
 
1782
26      4
 
1783
27      3
 
1784
28      2
 
1785
29      3
 
1786
30      5
 
1787
31      6
 
1788
32      8
 
1789
33      9
 
1790
34      745
 
1791
35      34
 
1792
36      34
 
1793
37      324
 
1794
38      67
 
1795
39      78
 
1796
40      89
 
1797
41      90
 
1798
42      78967
 
1799
50      56
 
1800
51      34
 
1801
55      123
 
1802
select * from t5 order by colint;
 
1803
colint  col1
 
1804
1       5
 
1805
2       13
 
1806
3       15
 
1807
4       17
 
1808
5       23
 
1809
6       34
 
1810
7       56
 
1811
8       56
 
1812
9       45
 
1813
10      34
 
1814
11      78
 
1815
12      89
 
1816
13      67
 
1817
14      46
 
1818
15      34
 
1819
16      324
 
1820
17      345
 
1821
18      34
 
1822
19      78
 
1823
20      567
 
1824
21      4
 
1825
22      435
 
1826
23      34
 
1827
24      45
 
1828
25      4565
 
1829
26      4
 
1830
27      3
 
1831
28      2
 
1832
29      3
 
1833
30      5
 
1834
31      6
 
1835
32      8
 
1836
33      9
 
1837
34      745
 
1838
35      34
 
1839
36      34
 
1840
37      324
 
1841
38      67
 
1842
39      78
 
1843
40      89
 
1844
41      90
 
1845
42      78967
 
1846
50      56
 
1847
51      34
 
1848
55      123
 
1849
select * from t6 order by colint;
 
1850
colint  col1
 
1851
1       5
 
1852
2       13
 
1853
3       15
 
1854
4       17
 
1855
5       23
 
1856
6       34
 
1857
7       56
 
1858
8       56
 
1859
9       45
 
1860
10      34
 
1861
11      78
 
1862
12      89
 
1863
13      67
 
1864
14      46
 
1865
15      34
 
1866
16      324
 
1867
17      345
 
1868
18      34
 
1869
19      78
 
1870
20      567
 
1871
21      4
 
1872
22      435
 
1873
23      34
 
1874
24      45
 
1875
25      4565
 
1876
26      4
 
1877
27      3
 
1878
28      2
 
1879
29      3
 
1880
30      5
 
1881
31      6
 
1882
32      8
 
1883
33      9
 
1884
34      745
 
1885
35      34
 
1886
36      34
 
1887
37      324
 
1888
38      67
 
1889
39      78
 
1890
40      89
 
1891
41      90
 
1892
42      78967
 
1893
50      56
 
1894
51      34
 
1895
55      123
 
1896
update t1 set col1=15  where col1=5;
 
1897
update t2 set col1=15  where col1=5;
 
1898
update t3 set col1=15  where col1=5;
 
1899
update t4 set col1=15  where col1=5;
 
1900
update t5 set col1=15  where col1=5;
 
1901
update t6 set col1=15  where col1=5;
 
1902
select * from t1 order by col1;
 
1903
col1
 
1904
15
 
1905
19
 
1906
select * from t2 order by col1;
 
1907
col1
 
1908
15
 
1909
17
 
1910
19
 
1911
select * from t3 order by col1;
 
1912
col1
 
1913
15
 
1914
17
 
1915
19
 
1916
select * from t4 order by colint;
 
1917
colint  col1
 
1918
1       15
 
1919
2       13
 
1920
3       15
 
1921
4       17
 
1922
5       23
 
1923
6       34
 
1924
7       56
 
1925
8       56
 
1926
9       45
 
1927
10      34
 
1928
11      78
 
1929
12      89
 
1930
13      67
 
1931
14      46
 
1932
15      34
 
1933
16      324
 
1934
17      345
 
1935
18      34
 
1936
19      78
 
1937
20      567
 
1938
21      4
 
1939
22      435
 
1940
23      34
 
1941
24      45
 
1942
25      4565
 
1943
26      4
 
1944
27      3
 
1945
28      2
 
1946
29      3
 
1947
30      15
 
1948
31      6
 
1949
32      8
 
1950
33      9
 
1951
34      745
 
1952
35      34
 
1953
36      34
 
1954
37      324
 
1955
38      67
 
1956
39      78
 
1957
40      89
 
1958
41      90
 
1959
42      78967
 
1960
50      56
 
1961
51      34
 
1962
55      123
 
1963
select * from t5 order by colint;
 
1964
colint  col1
 
1965
1       15
 
1966
2       13
 
1967
3       15
 
1968
4       17
 
1969
5       23
 
1970
6       34
 
1971
7       56
 
1972
8       56
 
1973
9       45
 
1974
10      34
 
1975
11      78
 
1976
12      89
 
1977
13      67
 
1978
14      46
 
1979
15      34
 
1980
16      324
 
1981
17      345
 
1982
18      34
 
1983
19      78
 
1984
20      567
 
1985
21      4
 
1986
22      435
 
1987
23      34
 
1988
24      45
 
1989
25      4565
 
1990
26      4
 
1991
27      3
 
1992
28      2
 
1993
29      3
 
1994
30      15
 
1995
31      6
 
1996
32      8
 
1997
33      9
 
1998
34      745
 
1999
35      34
 
2000
36      34
 
2001
37      324
 
2002
38      67
 
2003
39      78
 
2004
40      89
 
2005
41      90
 
2006
42      78967
 
2007
50      56
 
2008
51      34
 
2009
55      123
 
2010
select * from t6 order by colint;
 
2011
colint  col1
 
2012
1       15
 
2013
2       13
 
2014
3       15
 
2015
4       17
 
2016
5       23
 
2017
6       34
 
2018
7       56
 
2019
8       56
 
2020
9       45
 
2021
10      34
 
2022
11      78
 
2023
12      89
 
2024
13      67
 
2025
14      46
 
2026
15      34
 
2027
16      324
 
2028
17      345
 
2029
18      34
 
2030
19      78
 
2031
20      567
 
2032
21      4
 
2033
22      435
 
2034
23      34
 
2035
24      45
 
2036
25      4565
 
2037
26      4
 
2038
27      3
 
2039
28      2
 
2040
29      3
 
2041
30      15
 
2042
31      6
 
2043
32      8
 
2044
33      9
 
2045
34      745
 
2046
35      34
 
2047
36      34
 
2048
37      324
 
2049
38      67
 
2050
39      78
 
2051
40      89
 
2052
41      90
 
2053
42      78967
 
2054
50      56
 
2055
51      34
 
2056
55      123
 
2057
-------------------------------------------------------------------------
 
2058
---  Alter tables with mod(col1,10)
 
2059
-------------------------------------------------------------------------
 
2060
drop table if exists t11 ;
 
2061
drop table if exists t22 ;
 
2062
drop table if exists t33 ;
 
2063
drop table if exists t44 ;
 
2064
drop table if exists t55 ;
 
2065
drop table if exists t66 ;
 
2066
create table t11 engine='MYISAM' as select * from t1;
 
2067
create table t22 engine='MYISAM' as select * from t2;
 
2068
create table t33 engine='MYISAM' as select * from t3;
 
2069
create table t44 engine='MYISAM' as select * from t4;
 
2070
create table t55 engine='MYISAM' as select * from t5;
 
2071
create table t66 engine='MYISAM' as select * from t6;
 
2072
alter table t11
 
2073
partition by range(mod(col1,10)) 
 
2074
(partition p0 values less than (15),
 
2075
partition p1 values less than maxvalue);
 
2076
alter table t22
 
2077
partition by list(mod(col1,10)) 
 
2078
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
2079
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
2080
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
2081
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
2082
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
2083
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
2084
);
 
2085
alter table t33
 
2086
partition by hash(mod(col1,10));
 
2087
alter table t44
 
2088
partition by range(colint) 
 
2089
subpartition by hash(mod(col1,10)) subpartitions 2 
 
2090
(partition p0 values less than (15),
 
2091
partition p1 values less than maxvalue);
 
2092
alter table t55
 
2093
partition by list(colint)
 
2094
subpartition by hash(mod(col1,10)) subpartitions 2 
 
2095
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
2096
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
2097
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
2098
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
2099
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
2100
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
2101
);
 
2102
alter table t66
 
2103
partition by range(colint) 
 
2104
(partition p0 values less than (mod(15,10)),
 
2105
partition p1 values less than maxvalue);
 
2106
select * from t11 order by col1;
 
2107
col1
 
2108
15
 
2109
19
 
2110
select * from t22 order by col1;
 
2111
col1
 
2112
15
 
2113
17
 
2114
19
 
2115
select * from t33 order by col1;
 
2116
col1
 
2117
15
 
2118
17
 
2119
19
 
2120
select * from t44 order by colint;
 
2121
colint  col1
 
2122
1       15
 
2123
2       13
 
2124
3       15
 
2125
4       17
 
2126
5       23
 
2127
6       34
 
2128
7       56
 
2129
8       56
 
2130
9       45
 
2131
10      34
 
2132
11      78
 
2133
12      89
 
2134
13      67
 
2135
14      46
 
2136
15      34
 
2137
16      324
 
2138
17      345
 
2139
18      34
 
2140
19      78
 
2141
20      567
 
2142
21      4
 
2143
22      435
 
2144
23      34
 
2145
24      45
 
2146
25      4565
 
2147
26      4
 
2148
27      3
 
2149
28      2
 
2150
29      3
 
2151
30      15
 
2152
31      6
 
2153
32      8
 
2154
33      9
 
2155
34      745
 
2156
35      34
 
2157
36      34
 
2158
37      324
 
2159
38      67
 
2160
39      78
 
2161
40      89
 
2162
41      90
 
2163
42      78967
 
2164
50      56
 
2165
51      34
 
2166
55      123
 
2167
select * from t55 order by colint;
 
2168
colint  col1
 
2169
1       15
 
2170
2       13
 
2171
3       15
 
2172
4       17
 
2173
5       23
 
2174
6       34
 
2175
7       56
 
2176
8       56
 
2177
9       45
 
2178
10      34
 
2179
11      78
 
2180
12      89
 
2181
13      67
 
2182
14      46
 
2183
15      34
 
2184
16      324
 
2185
17      345
 
2186
18      34
 
2187
19      78
 
2188
20      567
 
2189
21      4
 
2190
22      435
 
2191
23      34
 
2192
24      45
 
2193
25      4565
 
2194
26      4
 
2195
27      3
 
2196
28      2
 
2197
29      3
 
2198
30      15
 
2199
31      6
 
2200
32      8
 
2201
33      9
 
2202
34      745
 
2203
35      34
 
2204
36      34
 
2205
37      324
 
2206
38      67
 
2207
39      78
 
2208
40      89
 
2209
41      90
 
2210
42      78967
 
2211
50      56
 
2212
51      34
 
2213
55      123
 
2214
select * from t66 order by colint;
 
2215
colint  col1
 
2216
1       15
 
2217
2       13
 
2218
3       15
 
2219
4       17
 
2220
5       23
 
2221
6       34
 
2222
7       56
 
2223
8       56
 
2224
9       45
 
2225
10      34
 
2226
11      78
 
2227
12      89
 
2228
13      67
 
2229
14      46
 
2230
15      34
 
2231
16      324
 
2232
17      345
 
2233
18      34
 
2234
19      78
 
2235
20      567
 
2236
21      4
 
2237
22      435
 
2238
23      34
 
2239
24      45
 
2240
25      4565
 
2241
26      4
 
2242
27      3
 
2243
28      2
 
2244
29      3
 
2245
30      15
 
2246
31      6
 
2247
32      8
 
2248
33      9
 
2249
34      745
 
2250
35      34
 
2251
36      34
 
2252
37      324
 
2253
38      67
 
2254
39      78
 
2255
40      89
 
2256
41      90
 
2257
42      78967
 
2258
50      56
 
2259
51      34
 
2260
55      123
 
2261
---------------------------
 
2262
---- some alter table begin
 
2263
---------------------------
 
2264
alter table t11
 
2265
reorganize partition p0,p1 into
 
2266
(partition s1 values less than maxvalue);
 
2267
select * from t11 order by col1;
 
2268
col1
 
2269
15
 
2270
19
 
2271
alter table t11
 
2272
reorganize partition s1 into
 
2273
(partition p0 values less than (15),
 
2274
partition p1 values less than maxvalue);
 
2275
select * from t11 order by col1;
 
2276
col1
 
2277
15
 
2278
19
 
2279
alter table t55
 
2280
partition by list(colint)
 
2281
subpartition by hash(mod(col1,10)) subpartitions 5 
 
2282
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
2283
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
2284
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
2285
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
2286
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
2287
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
2288
);
 
2289
show create table t55;
 
2290
Table   Create Table
 
2291
t55     CREATE TABLE `t55` (
 
2292
  `colint` int(11) DEFAULT NULL,
 
2293
  `col1` int(11) DEFAULT NULL
 
2294
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (mod(col1,10)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
 
2295
select * from t55 order by colint;
 
2296
colint  col1
 
2297
1       15
 
2298
2       13
 
2299
3       15
 
2300
4       17
 
2301
5       23
 
2302
6       34
 
2303
7       56
 
2304
8       56
 
2305
9       45
 
2306
10      34
 
2307
11      78
 
2308
12      89
 
2309
13      67
 
2310
14      46
 
2311
15      34
 
2312
16      324
 
2313
17      345
 
2314
18      34
 
2315
19      78
 
2316
20      567
 
2317
21      4
 
2318
22      435
 
2319
23      34
 
2320
24      45
 
2321
25      4565
 
2322
26      4
 
2323
27      3
 
2324
28      2
 
2325
29      3
 
2326
30      15
 
2327
31      6
 
2328
32      8
 
2329
33      9
 
2330
34      745
 
2331
35      34
 
2332
36      34
 
2333
37      324
 
2334
38      67
 
2335
39      78
 
2336
40      89
 
2337
41      90
 
2338
42      78967
 
2339
50      56
 
2340
51      34
 
2341
55      123
 
2342
alter table t66
 
2343
reorganize partition p0,p1 into
 
2344
(partition s1 values less than maxvalue);
 
2345
select * from t66 order by colint;
 
2346
colint  col1
 
2347
1       15
 
2348
2       13
 
2349
3       15
 
2350
4       17
 
2351
5       23
 
2352
6       34
 
2353
7       56
 
2354
8       56
 
2355
9       45
 
2356
10      34
 
2357
11      78
 
2358
12      89
 
2359
13      67
 
2360
14      46
 
2361
15      34
 
2362
16      324
 
2363
17      345
 
2364
18      34
 
2365
19      78
 
2366
20      567
 
2367
21      4
 
2368
22      435
 
2369
23      34
 
2370
24      45
 
2371
25      4565
 
2372
26      4
 
2373
27      3
 
2374
28      2
 
2375
29      3
 
2376
30      15
 
2377
31      6
 
2378
32      8
 
2379
33      9
 
2380
34      745
 
2381
35      34
 
2382
36      34
 
2383
37      324
 
2384
38      67
 
2385
39      78
 
2386
40      89
 
2387
41      90
 
2388
42      78967
 
2389
50      56
 
2390
51      34
 
2391
55      123
 
2392
alter table t66
 
2393
reorganize partition s1 into
 
2394
(partition p0 values less than (mod(15,10)),
 
2395
partition p1 values less than maxvalue);
 
2396
select * from t66 order by colint;
 
2397
colint  col1
 
2398
1       15
 
2399
2       13
 
2400
3       15
 
2401
4       17
 
2402
5       23
 
2403
6       34
 
2404
7       56
 
2405
8       56
 
2406
9       45
 
2407
10      34
 
2408
11      78
 
2409
12      89
 
2410
13      67
 
2411
14      46
 
2412
15      34
 
2413
16      324
 
2414
17      345
 
2415
18      34
 
2416
19      78
 
2417
20      567
 
2418
21      4
 
2419
22      435
 
2420
23      34
 
2421
24      45
 
2422
25      4565
 
2423
26      4
 
2424
27      3
 
2425
28      2
 
2426
29      3
 
2427
30      15
 
2428
31      6
 
2429
32      8
 
2430
33      9
 
2431
34      745
 
2432
35      34
 
2433
36      34
 
2434
37      324
 
2435
38      67
 
2436
39      78
 
2437
40      89
 
2438
41      90
 
2439
42      78967
 
2440
50      56
 
2441
51      34
 
2442
55      123
 
2443
alter table t66
 
2444
reorganize partition p0,p1 into
 
2445
(partition s1 values less than maxvalue);
 
2446
select * from t66 order by colint;
 
2447
colint  col1
 
2448
1       15
 
2449
2       13
 
2450
3       15
 
2451
4       17
 
2452
5       23
 
2453
6       34
 
2454
7       56
 
2455
8       56
 
2456
9       45
 
2457
10      34
 
2458
11      78
 
2459
12      89
 
2460
13      67
 
2461
14      46
 
2462
15      34
 
2463
16      324
 
2464
17      345
 
2465
18      34
 
2466
19      78
 
2467
20      567
 
2468
21      4
 
2469
22      435
 
2470
23      34
 
2471
24      45
 
2472
25      4565
 
2473
26      4
 
2474
27      3
 
2475
28      2
 
2476
29      3
 
2477
30      15
 
2478
31      6
 
2479
32      8
 
2480
33      9
 
2481
34      745
 
2482
35      34
 
2483
36      34
 
2484
37      324
 
2485
38      67
 
2486
39      78
 
2487
40      89
 
2488
41      90
 
2489
42      78967
 
2490
50      56
 
2491
51      34
 
2492
55      123
 
2493
alter table t66
 
2494
reorganize partition s1 into
 
2495
(partition p0 values less than (mod(15,10)),
 
2496
partition p1 values less than maxvalue);
 
2497
select * from t66 order by colint;
 
2498
colint  col1
 
2499
1       15
 
2500
2       13
 
2501
3       15
 
2502
4       17
 
2503
5       23
 
2504
6       34
 
2505
7       56
 
2506
8       56
 
2507
9       45
 
2508
10      34
 
2509
11      78
 
2510
12      89
 
2511
13      67
 
2512
14      46
 
2513
15      34
 
2514
16      324
 
2515
17      345
 
2516
18      34
 
2517
19      78
 
2518
20      567
 
2519
21      4
 
2520
22      435
 
2521
23      34
 
2522
24      45
 
2523
25      4565
 
2524
26      4
 
2525
27      3
 
2526
28      2
 
2527
29      3
 
2528
30      15
 
2529
31      6
 
2530
32      8
 
2531
33      9
 
2532
34      745
 
2533
35      34
 
2534
36      34
 
2535
37      324
 
2536
38      67
 
2537
39      78
 
2538
40      89
 
2539
41      90
 
2540
42      78967
 
2541
50      56
 
2542
51      34
 
2543
55      123
 
2544
-------------------------------------------------------------------------
 
2545
---  Delete rows and partitions of tables with mod(col1,10)
 
2546
-------------------------------------------------------------------------
 
2547
delete from t1 where col1=19;
 
2548
delete from t2 where col1=19;
 
2549
delete from t3 where col1=19;
 
2550
delete from t4 where col1=19;
 
2551
delete from t5 where col1=19;
 
2552
delete from t6 where col1=19;
 
2553
select * from t1 order by col1;
 
2554
col1
 
2555
15
 
2556
select * from t2 order by col1;
 
2557
col1
 
2558
15
 
2559
17
 
2560
select * from t3 order by col1;
 
2561
col1
 
2562
15
 
2563
17
 
2564
select * from t4 order by colint;
 
2565
colint  col1
 
2566
1       15
 
2567
2       13
 
2568
3       15
 
2569
4       17
 
2570
5       23
 
2571
6       34
 
2572
7       56
 
2573
8       56
 
2574
9       45
 
2575
10      34
 
2576
11      78
 
2577
12      89
 
2578
13      67
 
2579
14      46
 
2580
15      34
 
2581
16      324
 
2582
17      345
 
2583
18      34
 
2584
19      78
 
2585
20      567
 
2586
21      4
 
2587
22      435
 
2588
23      34
 
2589
24      45
 
2590
25      4565
 
2591
26      4
 
2592
27      3
 
2593
28      2
 
2594
29      3
 
2595
30      15
 
2596
31      6
 
2597
32      8
 
2598
33      9
 
2599
34      745
 
2600
35      34
 
2601
36      34
 
2602
37      324
 
2603
38      67
 
2604
39      78
 
2605
40      89
 
2606
41      90
 
2607
42      78967
 
2608
50      56
 
2609
51      34
 
2610
55      123
 
2611
select * from t5 order by colint;
 
2612
colint  col1
 
2613
1       15
 
2614
2       13
 
2615
3       15
 
2616
4       17
 
2617
5       23
 
2618
6       34
 
2619
7       56
 
2620
8       56
 
2621
9       45
 
2622
10      34
 
2623
11      78
 
2624
12      89
 
2625
13      67
 
2626
14      46
 
2627
15      34
 
2628
16      324
 
2629
17      345
 
2630
18      34
 
2631
19      78
 
2632
20      567
 
2633
21      4
 
2634
22      435
 
2635
23      34
 
2636
24      45
 
2637
25      4565
 
2638
26      4
 
2639
27      3
 
2640
28      2
 
2641
29      3
 
2642
30      15
 
2643
31      6
 
2644
32      8
 
2645
33      9
 
2646
34      745
 
2647
35      34
 
2648
36      34
 
2649
37      324
 
2650
38      67
 
2651
39      78
 
2652
40      89
 
2653
41      90
 
2654
42      78967
 
2655
50      56
 
2656
51      34
 
2657
55      123
 
2658
insert into t1 values (19);
 
2659
insert into t2 values (19);
 
2660
insert into t3 values (19);
 
2661
insert into t4 values (60,19);
 
2662
insert into t5 values (60,19);
 
2663
insert into t6 values (60,19);
 
2664
select * from t1 order by col1;
 
2665
col1
 
2666
15
 
2667
19
 
2668
select * from t2 order by col1;
 
2669
col1
 
2670
15
 
2671
17
 
2672
19
 
2673
select * from t3 order by col1;
 
2674
col1
 
2675
15
 
2676
17
 
2677
19
 
2678
select * from t4 order by colint;
 
2679
colint  col1
 
2680
1       15
 
2681
2       13
 
2682
3       15
 
2683
4       17
 
2684
5       23
 
2685
6       34
 
2686
7       56
 
2687
8       56
 
2688
9       45
 
2689
10      34
 
2690
11      78
 
2691
12      89
 
2692
13      67
 
2693
14      46
 
2694
15      34
 
2695
16      324
 
2696
17      345
 
2697
18      34
 
2698
19      78
 
2699
20      567
 
2700
21      4
 
2701
22      435
 
2702
23      34
 
2703
24      45
 
2704
25      4565
 
2705
26      4
 
2706
27      3
 
2707
28      2
 
2708
29      3
 
2709
30      15
 
2710
31      6
 
2711
32      8
 
2712
33      9
 
2713
34      745
 
2714
35      34
 
2715
36      34
 
2716
37      324
 
2717
38      67
 
2718
39      78
 
2719
40      89
 
2720
41      90
 
2721
42      78967
 
2722
50      56
 
2723
51      34
 
2724
55      123
 
2725
60      19
 
2726
select * from t5 order by colint;
 
2727
colint  col1
 
2728
1       15
 
2729
2       13
 
2730
3       15
 
2731
4       17
 
2732
5       23
 
2733
6       34
 
2734
7       56
 
2735
8       56
 
2736
9       45
 
2737
10      34
 
2738
11      78
 
2739
12      89
 
2740
13      67
 
2741
14      46
 
2742
15      34
 
2743
16      324
 
2744
17      345
 
2745
18      34
 
2746
19      78
 
2747
20      567
 
2748
21      4
 
2749
22      435
 
2750
23      34
 
2751
24      45
 
2752
25      4565
 
2753
26      4
 
2754
27      3
 
2755
28      2
 
2756
29      3
 
2757
30      15
 
2758
31      6
 
2759
32      8
 
2760
33      9
 
2761
34      745
 
2762
35      34
 
2763
36      34
 
2764
37      324
 
2765
38      67
 
2766
39      78
 
2767
40      89
 
2768
41      90
 
2769
42      78967
 
2770
50      56
 
2771
51      34
 
2772
55      123
 
2773
60      19
 
2774
select * from t6 order by colint;
 
2775
colint  col1
 
2776
1       15
 
2777
2       13
 
2778
3       15
 
2779
4       17
 
2780
5       23
 
2781
6       34
 
2782
7       56
 
2783
8       56
 
2784
9       45
 
2785
10      34
 
2786
11      78
 
2787
12      89
 
2788
13      67
 
2789
14      46
 
2790
15      34
 
2791
16      324
 
2792
17      345
 
2793
18      34
 
2794
19      78
 
2795
20      567
 
2796
21      4
 
2797
22      435
 
2798
23      34
 
2799
24      45
 
2800
25      4565
 
2801
26      4
 
2802
27      3
 
2803
28      2
 
2804
29      3
 
2805
30      15
 
2806
31      6
 
2807
32      8
 
2808
33      9
 
2809
34      745
 
2810
35      34
 
2811
36      34
 
2812
37      324
 
2813
38      67
 
2814
39      78
 
2815
40      89
 
2816
41      90
 
2817
42      78967
 
2818
50      56
 
2819
51      34
 
2820
55      123
 
2821
60      19
 
2822
alter table t1 drop partition p0;
 
2823
alter table t2 drop partition p0;
 
2824
alter table t4 drop partition p0;
 
2825
alter table t5 drop partition p0;
 
2826
alter table t6 drop partition p0;
 
2827
select * from t1 order by col1;
 
2828
col1
 
2829
select * from t2 order by col1;
 
2830
col1
 
2831
select * from t3 order by col1;
 
2832
col1
 
2833
15
 
2834
17
 
2835
19
 
2836
select * from t4 order by colint;
 
2837
colint  col1
 
2838
15      34
 
2839
16      324
 
2840
17      345
 
2841
18      34
 
2842
19      78
 
2843
20      567
 
2844
21      4
 
2845
22      435
 
2846
23      34
 
2847
24      45
 
2848
25      4565
 
2849
26      4
 
2850
27      3
 
2851
28      2
 
2852
29      3
 
2853
30      15
 
2854
31      6
 
2855
32      8
 
2856
33      9
 
2857
34      745
 
2858
35      34
 
2859
36      34
 
2860
37      324
 
2861
38      67
 
2862
39      78
 
2863
40      89
 
2864
41      90
 
2865
42      78967
 
2866
50      56
 
2867
51      34
 
2868
55      123
 
2869
60      19
 
2870
select * from t5 order by colint;
 
2871
colint  col1
 
2872
11      78
 
2873
12      89
 
2874
13      67
 
2875
14      46
 
2876
15      34
 
2877
16      324
 
2878
17      345
 
2879
18      34
 
2880
19      78
 
2881
20      567
 
2882
21      4
 
2883
22      435
 
2884
23      34
 
2885
24      45
 
2886
25      4565
 
2887
26      4
 
2888
27      3
 
2889
28      2
 
2890
29      3
 
2891
30      15
 
2892
31      6
 
2893
32      8
 
2894
33      9
 
2895
34      745
 
2896
35      34
 
2897
36      34
 
2898
37      324
 
2899
38      67
 
2900
39      78
 
2901
40      89
 
2902
41      90
 
2903
42      78967
 
2904
50      56
 
2905
51      34
 
2906
55      123
 
2907
60      19
 
2908
select * from t6 order by colint;
 
2909
colint  col1
 
2910
5       23
 
2911
6       34
 
2912
7       56
 
2913
8       56
 
2914
9       45
 
2915
10      34
 
2916
11      78
 
2917
12      89
 
2918
13      67
 
2919
14      46
 
2920
15      34
 
2921
16      324
 
2922
17      345
 
2923
18      34
 
2924
19      78
 
2925
20      567
 
2926
21      4
 
2927
22      435
 
2928
23      34
 
2929
24      45
 
2930
25      4565
 
2931
26      4
 
2932
27      3
 
2933
28      2
 
2934
29      3
 
2935
30      15
 
2936
31      6
 
2937
32      8
 
2938
33      9
 
2939
34      745
 
2940
35      34
 
2941
36      34
 
2942
37      324
 
2943
38      67
 
2944
39      78
 
2945
40      89
 
2946
41      90
 
2947
42      78967
 
2948
50      56
 
2949
51      34
 
2950
55      123
 
2951
60      19
 
2952
-------------------------------------------------------------------------
 
2953
---  Delete rows and partitions of tables with mod(col1,10)
 
2954
-------------------------------------------------------------------------
 
2955
delete from t11 where col1=19;
 
2956
delete from t22 where col1=19;
 
2957
delete from t33 where col1=19;
 
2958
delete from t44 where col1=19;
 
2959
delete from t55 where col1=19;
 
2960
delete from t66 where col1=19;
 
2961
select * from t11 order by col1;
 
2962
col1
 
2963
15
 
2964
select * from t22 order by col1;
 
2965
col1
 
2966
15
 
2967
17
 
2968
select * from t33 order by col1;
 
2969
col1
 
2970
15
 
2971
17
 
2972
select * from t44 order by colint;
 
2973
colint  col1
 
2974
1       15
 
2975
2       13
 
2976
3       15
 
2977
4       17
 
2978
5       23
 
2979
6       34
 
2980
7       56
 
2981
8       56
 
2982
9       45
 
2983
10      34
 
2984
11      78
 
2985
12      89
 
2986
13      67
 
2987
14      46
 
2988
15      34
 
2989
16      324
 
2990
17      345
 
2991
18      34
 
2992
19      78
 
2993
20      567
 
2994
21      4
 
2995
22      435
 
2996
23      34
 
2997
24      45
 
2998
25      4565
 
2999
26      4
 
3000
27      3
 
3001
28      2
 
3002
29      3
 
3003
30      15
 
3004
31      6
 
3005
32      8
 
3006
33      9
 
3007
34      745
 
3008
35      34
 
3009
36      34
 
3010
37      324
 
3011
38      67
 
3012
39      78
 
3013
40      89
 
3014
41      90
 
3015
42      78967
 
3016
50      56
 
3017
51      34
 
3018
55      123
 
3019
select * from t55 order by colint;
 
3020
colint  col1
 
3021
1       15
 
3022
2       13
 
3023
3       15
 
3024
4       17
 
3025
5       23
 
3026
6       34
 
3027
7       56
 
3028
8       56
 
3029
9       45
 
3030
10      34
 
3031
11      78
 
3032
12      89
 
3033
13      67
 
3034
14      46
 
3035
15      34
 
3036
16      324
 
3037
17      345
 
3038
18      34
 
3039
19      78
 
3040
20      567
 
3041
21      4
 
3042
22      435
 
3043
23      34
 
3044
24      45
 
3045
25      4565
 
3046
26      4
 
3047
27      3
 
3048
28      2
 
3049
29      3
 
3050
30      15
 
3051
31      6
 
3052
32      8
 
3053
33      9
 
3054
34      745
 
3055
35      34
 
3056
36      34
 
3057
37      324
 
3058
38      67
 
3059
39      78
 
3060
40      89
 
3061
41      90
 
3062
42      78967
 
3063
50      56
 
3064
51      34
 
3065
55      123
 
3066
insert into t11 values (19);
 
3067
insert into t22 values (19);
 
3068
insert into t33 values (19);
 
3069
insert into t44 values (60,19);
 
3070
insert into t55 values (60,19);
 
3071
insert into t66 values (60,19);
 
3072
select * from t11 order by col1;
 
3073
col1
 
3074
15
 
3075
19
 
3076
select * from t22 order by col1;
 
3077
col1
 
3078
15
 
3079
17
 
3080
19
 
3081
select * from t33 order by col1;
 
3082
col1
 
3083
15
 
3084
17
 
3085
19
 
3086
select * from t44 order by colint;
 
3087
colint  col1
 
3088
1       15
 
3089
2       13
 
3090
3       15
 
3091
4       17
 
3092
5       23
 
3093
6       34
 
3094
7       56
 
3095
8       56
 
3096
9       45
 
3097
10      34
 
3098
11      78
 
3099
12      89
 
3100
13      67
 
3101
14      46
 
3102
15      34
 
3103
16      324
 
3104
17      345
 
3105
18      34
 
3106
19      78
 
3107
20      567
 
3108
21      4
 
3109
22      435
 
3110
23      34
 
3111
24      45
 
3112
25      4565
 
3113
26      4
 
3114
27      3
 
3115
28      2
 
3116
29      3
 
3117
30      15
 
3118
31      6
 
3119
32      8
 
3120
33      9
 
3121
34      745
 
3122
35      34
 
3123
36      34
 
3124
37      324
 
3125
38      67
 
3126
39      78
 
3127
40      89
 
3128
41      90
 
3129
42      78967
 
3130
50      56
 
3131
51      34
 
3132
55      123
 
3133
60      19
 
3134
select * from t55 order by colint;
 
3135
colint  col1
 
3136
1       15
 
3137
2       13
 
3138
3       15
 
3139
4       17
 
3140
5       23
 
3141
6       34
 
3142
7       56
 
3143
8       56
 
3144
9       45
 
3145
10      34
 
3146
11      78
 
3147
12      89
 
3148
13      67
 
3149
14      46
 
3150
15      34
 
3151
16      324
 
3152
17      345
 
3153
18      34
 
3154
19      78
 
3155
20      567
 
3156
21      4
 
3157
22      435
 
3158
23      34
 
3159
24      45
 
3160
25      4565
 
3161
26      4
 
3162
27      3
 
3163
28      2
 
3164
29      3
 
3165
30      15
 
3166
31      6
 
3167
32      8
 
3168
33      9
 
3169
34      745
 
3170
35      34
 
3171
36      34
 
3172
37      324
 
3173
38      67
 
3174
39      78
 
3175
40      89
 
3176
41      90
 
3177
42      78967
 
3178
50      56
 
3179
51      34
 
3180
55      123
 
3181
60      19
 
3182
select * from t66 order by colint;
 
3183
colint  col1
 
3184
1       15
 
3185
2       13
 
3186
3       15
 
3187
4       17
 
3188
5       23
 
3189
6       34
 
3190
7       56
 
3191
8       56
 
3192
9       45
 
3193
10      34
 
3194
11      78
 
3195
12      89
 
3196
13      67
 
3197
14      46
 
3198
15      34
 
3199
16      324
 
3200
17      345
 
3201
18      34
 
3202
19      78
 
3203
20      567
 
3204
21      4
 
3205
22      435
 
3206
23      34
 
3207
24      45
 
3208
25      4565
 
3209
26      4
 
3210
27      3
 
3211
28      2
 
3212
29      3
 
3213
30      15
 
3214
31      6
 
3215
32      8
 
3216
33      9
 
3217
34      745
 
3218
35      34
 
3219
36      34
 
3220
37      324
 
3221
38      67
 
3222
39      78
 
3223
40      89
 
3224
41      90
 
3225
42      78967
 
3226
50      56
 
3227
51      34
 
3228
55      123
 
3229
60      19
 
3230
alter table t11 drop partition p0;
 
3231
alter table t22 drop partition p0;
 
3232
alter table t44 drop partition p0;
 
3233
alter table t55 drop partition p0;
 
3234
alter table t66 drop partition p0;
 
3235
select * from t11 order by col1;
 
3236
col1
 
3237
select * from t22 order by col1;
 
3238
col1
 
3239
select * from t33 order by col1;
 
3240
col1
 
3241
15
 
3242
17
 
3243
19
 
3244
select * from t44 order by colint;
 
3245
colint  col1
 
3246
15      34
 
3247
16      324
 
3248
17      345
 
3249
18      34
 
3250
19      78
 
3251
20      567
 
3252
21      4
 
3253
22      435
 
3254
23      34
 
3255
24      45
 
3256
25      4565
 
3257
26      4
 
3258
27      3
 
3259
28      2
 
3260
29      3
 
3261
30      15
 
3262
31      6
 
3263
32      8
 
3264
33      9
 
3265
34      745
 
3266
35      34
 
3267
36      34
 
3268
37      324
 
3269
38      67
 
3270
39      78
 
3271
40      89
 
3272
41      90
 
3273
42      78967
 
3274
50      56
 
3275
51      34
 
3276
55      123
 
3277
60      19
 
3278
select * from t55 order by colint;
 
3279
colint  col1
 
3280
11      78
 
3281
12      89
 
3282
13      67
 
3283
14      46
 
3284
15      34
 
3285
16      324
 
3286
17      345
 
3287
18      34
 
3288
19      78
 
3289
20      567
 
3290
21      4
 
3291
22      435
 
3292
23      34
 
3293
24      45
 
3294
25      4565
 
3295
26      4
 
3296
27      3
 
3297
28      2
 
3298
29      3
 
3299
30      15
 
3300
31      6
 
3301
32      8
 
3302
33      9
 
3303
34      745
 
3304
35      34
 
3305
36      34
 
3306
37      324
 
3307
38      67
 
3308
39      78
 
3309
40      89
 
3310
41      90
 
3311
42      78967
 
3312
50      56
 
3313
51      34
 
3314
55      123
 
3315
60      19
 
3316
select * from t66 order by colint;
 
3317
colint  col1
 
3318
5       23
 
3319
6       34
 
3320
7       56
 
3321
8       56
 
3322
9       45
 
3323
10      34
 
3324
11      78
 
3325
12      89
 
3326
13      67
 
3327
14      46
 
3328
15      34
 
3329
16      324
 
3330
17      345
 
3331
18      34
 
3332
19      78
 
3333
20      567
 
3334
21      4
 
3335
22      435
 
3336
23      34
 
3337
24      45
 
3338
25      4565
 
3339
26      4
 
3340
27      3
 
3341
28      2
 
3342
29      3
 
3343
30      15
 
3344
31      6
 
3345
32      8
 
3346
33      9
 
3347
34      745
 
3348
35      34
 
3349
36      34
 
3350
37      324
 
3351
38      67
 
3352
39      78
 
3353
40      89
 
3354
41      90
 
3355
42      78967
 
3356
50      56
 
3357
51      34
 
3358
55      123
 
3359
60      19
 
3360
-------------------------
 
3361
---- some alter table end
 
3362
-------------------------
 
3363
drop table if exists t1 ;
 
3364
drop table if exists t2 ;
 
3365
drop table if exists t3 ;
 
3366
drop table if exists t4 ;
 
3367
drop table if exists t5 ;
 
3368
drop table if exists t6 ;
 
3369
drop table if exists t11 ;
 
3370
drop table if exists t22 ;
 
3371
drop table if exists t33 ;
 
3372
drop table if exists t44 ;
 
3373
drop table if exists t55 ;
 
3374
drop table if exists t66 ;
 
3375
-------------------------------------------------------------------------
 
3376
---  day(col1)  in partition with coltype  date
 
3377
-------------------------------------------------------------------------
 
3378
drop table if exists t1 ;
 
3379
drop table if exists t2 ;
 
3380
drop table if exists t3 ;
 
3381
drop table if exists t4 ;
 
3382
drop table if exists t5 ;
 
3383
drop table if exists t6 ;
 
3384
-------------------------------------------------------------------------
 
3385
---  Create tables with day(col1)
 
3386
-------------------------------------------------------------------------
 
3387
create table t1 (col1 date) engine='MYISAM' 
 
3388
partition by range(day(col1)) 
 
3389
(partition p0 values less than (15),
 
3390
partition p1 values less than maxvalue);
 
3391
create table t2 (col1 date) engine='MYISAM' 
 
3392
partition by list(day(col1)) 
 
3393
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
3394
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
3395
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
3396
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
3397
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
3398
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
3399
);
 
3400
create table t3 (col1 date) engine='MYISAM' 
 
3401
partition by hash(day(col1));
 
3402
create table t4 (colint int, col1 date) engine='MYISAM' 
 
3403
partition by range(colint) 
 
3404
subpartition by hash(day(col1)) subpartitions 2 
 
3405
(partition p0 values less than (15),
 
3406
partition p1 values less than maxvalue);
 
3407
create table t5 (colint int, col1 date) engine='MYISAM' 
 
3408
partition by list(colint)
 
3409
subpartition by hash(day(col1)) subpartitions 2 
 
3410
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
3411
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
3412
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
3413
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
3414
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
3415
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
3416
);
 
3417
create table t6 (colint int, col1 date) engine='MYISAM' 
 
3418
partition by range(colint) 
 
3419
(partition p0 values less than (day('2006-12-21')),
 
3420
partition p1 values less than maxvalue);
 
3421
-------------------------------------------------------------------------
 
3422
---  Access tables with day(col1) 
 
3423
-------------------------------------------------------------------------
 
3424
insert into t1 values ('2006-02-03');
 
3425
insert into t1 values ('2006-01-17');
 
3426
insert into t2 values ('2006-02-03');
 
3427
insert into t2 values ('2006-01-17');
 
3428
insert into t2 values ('2006-01-25');
 
3429
insert into t3 values ('2006-02-03');
 
3430
insert into t3 values ('2006-01-17');
 
3431
insert into t3 values ('2006-01-25');
 
3432
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
 
3433
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
 
3434
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
 
3435
select day(col1) from t1 order by col1;
 
3436
day(col1)
 
3437
17
 
3438
3
 
3439
select * from t1 order by col1;
 
3440
col1
 
3441
2006-01-17
 
3442
2006-02-03
 
3443
select * from t2 order by col1;
 
3444
col1
 
3445
2006-01-17
 
3446
2006-01-25
 
3447
2006-02-03
 
3448
select * from t3 order by col1;
 
3449
col1
 
3450
2006-01-17
 
3451
2006-01-25
 
3452
2006-02-03
 
3453
select * from t4 order by colint;
 
3454
colint  col1
 
3455
1       2006-02-03
 
3456
2       2006-01-17
 
3457
3       2006-01-25
 
3458
4       2006-02-05
 
3459
select * from t5 order by colint;
 
3460
colint  col1
 
3461
1       2006-02-03
 
3462
2       2006-01-17
 
3463
3       2006-01-25
 
3464
4       2006-02-05
 
3465
select * from t6 order by colint;
 
3466
colint  col1
 
3467
1       2006-02-03
 
3468
2       2006-01-17
 
3469
3       2006-01-25
 
3470
4       2006-02-05
 
3471
update t1 set col1='2006-02-05' where col1='2006-02-03';
 
3472
update t2 set col1='2006-02-05' where col1='2006-02-03';
 
3473
update t3 set col1='2006-02-05' where col1='2006-02-03';
 
3474
update t4 set col1='2006-02-05' where col1='2006-02-03';
 
3475
update t5 set col1='2006-02-05' where col1='2006-02-03';
 
3476
update t6 set col1='2006-02-05' where col1='2006-02-03';
 
3477
select * from t1 order by col1;
 
3478
col1
 
3479
2006-01-17
 
3480
2006-02-05
 
3481
select * from t2 order by col1;
 
3482
col1
 
3483
2006-01-17
 
3484
2006-01-25
 
3485
2006-02-05
 
3486
select * from t3 order by col1;
 
3487
col1
 
3488
2006-01-17
 
3489
2006-01-25
 
3490
2006-02-05
 
3491
select * from t4 order by colint;
 
3492
colint  col1
 
3493
1       2006-02-05
 
3494
2       2006-01-17
 
3495
3       2006-01-25
 
3496
4       2006-02-05
 
3497
select * from t5 order by colint;
 
3498
colint  col1
 
3499
1       2006-02-05
 
3500
2       2006-01-17
 
3501
3       2006-01-25
 
3502
4       2006-02-05
 
3503
select * from t6 order by colint;
 
3504
colint  col1
 
3505
1       2006-02-05
 
3506
2       2006-01-17
 
3507
3       2006-01-25
 
3508
4       2006-02-05
 
3509
-------------------------------------------------------------------------
 
3510
---  Alter tables with day(col1)
 
3511
-------------------------------------------------------------------------
 
3512
drop table if exists t11 ;
 
3513
drop table if exists t22 ;
 
3514
drop table if exists t33 ;
 
3515
drop table if exists t44 ;
 
3516
drop table if exists t55 ;
 
3517
drop table if exists t66 ;
 
3518
create table t11 engine='MYISAM' as select * from t1;
 
3519
create table t22 engine='MYISAM' as select * from t2;
 
3520
create table t33 engine='MYISAM' as select * from t3;
 
3521
create table t44 engine='MYISAM' as select * from t4;
 
3522
create table t55 engine='MYISAM' as select * from t5;
 
3523
create table t66 engine='MYISAM' as select * from t6;
 
3524
alter table t11
 
3525
partition by range(day(col1)) 
 
3526
(partition p0 values less than (15),
 
3527
partition p1 values less than maxvalue);
 
3528
alter table t22
 
3529
partition by list(day(col1)) 
 
3530
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
3531
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
3532
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
3533
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
3534
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
3535
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
3536
);
 
3537
alter table t33
 
3538
partition by hash(day(col1));
 
3539
alter table t44
 
3540
partition by range(colint) 
 
3541
subpartition by hash(day(col1)) subpartitions 2 
 
3542
(partition p0 values less than (15),
 
3543
partition p1 values less than maxvalue);
 
3544
alter table t55
 
3545
partition by list(colint)
 
3546
subpartition by hash(day(col1)) subpartitions 2 
 
3547
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
3548
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
3549
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
3550
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
3551
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
3552
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
3553
);
 
3554
alter table t66
 
3555
partition by range(colint) 
 
3556
(partition p0 values less than (day('2006-12-21')),
 
3557
partition p1 values less than maxvalue);
 
3558
select * from t11 order by col1;
 
3559
col1
 
3560
2006-01-17
 
3561
2006-02-05
 
3562
select * from t22 order by col1;
 
3563
col1
 
3564
2006-01-17
 
3565
2006-01-25
 
3566
2006-02-05
 
3567
select * from t33 order by col1;
 
3568
col1
 
3569
2006-01-17
 
3570
2006-01-25
 
3571
2006-02-05
 
3572
select * from t44 order by colint;
 
3573
colint  col1
 
3574
1       2006-02-05
 
3575
2       2006-01-17
 
3576
3       2006-01-25
 
3577
4       2006-02-05
 
3578
select * from t55 order by colint;
 
3579
colint  col1
 
3580
1       2006-02-05
 
3581
2       2006-01-17
 
3582
3       2006-01-25
 
3583
4       2006-02-05
 
3584
select * from t66 order by colint;
 
3585
colint  col1
 
3586
1       2006-02-05
 
3587
2       2006-01-17
 
3588
3       2006-01-25
 
3589
4       2006-02-05
 
3590
---------------------------
 
3591
---- some alter table begin
 
3592
---------------------------
 
3593
alter table t11
 
3594
reorganize partition p0,p1 into
 
3595
(partition s1 values less than maxvalue);
 
3596
select * from t11 order by col1;
 
3597
col1
 
3598
2006-01-17
 
3599
2006-02-05
 
3600
alter table t11
 
3601
reorganize partition s1 into
 
3602
(partition p0 values less than (15),
 
3603
partition p1 values less than maxvalue);
 
3604
select * from t11 order by col1;
 
3605
col1
 
3606
2006-01-17
 
3607
2006-02-05
 
3608
alter table t55
 
3609
partition by list(colint)
 
3610
subpartition by hash(day(col1)) subpartitions 5 
 
3611
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
3612
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
3613
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
3614
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
3615
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
3616
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
3617
);
 
3618
show create table t55;
 
3619
Table   Create Table
 
3620
t55     CREATE TABLE `t55` (
 
3621
  `colint` int(11) DEFAULT NULL,
 
3622
  `col1` date DEFAULT NULL
 
3623
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (day(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
 
3624
select * from t55 order by colint;
 
3625
colint  col1
 
3626
1       2006-02-05
 
3627
2       2006-01-17
 
3628
3       2006-01-25
 
3629
4       2006-02-05
 
3630
alter table t66
 
3631
reorganize partition p0,p1 into
 
3632
(partition s1 values less than maxvalue);
 
3633
select * from t66 order by colint;
 
3634
colint  col1
 
3635
1       2006-02-05
 
3636
2       2006-01-17
 
3637
3       2006-01-25
 
3638
4       2006-02-05
 
3639
alter table t66
 
3640
reorganize partition s1 into
 
3641
(partition p0 values less than (day('2006-12-21')),
 
3642
partition p1 values less than maxvalue);
 
3643
select * from t66 order by colint;
 
3644
colint  col1
 
3645
1       2006-02-05
 
3646
2       2006-01-17
 
3647
3       2006-01-25
 
3648
4       2006-02-05
 
3649
alter table t66
 
3650
reorganize partition p0,p1 into
 
3651
(partition s1 values less than maxvalue);
 
3652
select * from t66 order by colint;
 
3653
colint  col1
 
3654
1       2006-02-05
 
3655
2       2006-01-17
 
3656
3       2006-01-25
 
3657
4       2006-02-05
 
3658
alter table t66
 
3659
reorganize partition s1 into
 
3660
(partition p0 values less than (day('2006-12-21')),
 
3661
partition p1 values less than maxvalue);
 
3662
select * from t66 order by colint;
 
3663
colint  col1
 
3664
1       2006-02-05
 
3665
2       2006-01-17
 
3666
3       2006-01-25
 
3667
4       2006-02-05
 
3668
-------------------------------------------------------------------------
 
3669
---  Delete rows and partitions of tables with day(col1)
 
3670
-------------------------------------------------------------------------
 
3671
delete from t1 where col1='2006-01-17';
 
3672
delete from t2 where col1='2006-01-17';
 
3673
delete from t3 where col1='2006-01-17';
 
3674
delete from t4 where col1='2006-01-17';
 
3675
delete from t5 where col1='2006-01-17';
 
3676
delete from t6 where col1='2006-01-17';
 
3677
select * from t1 order by col1;
 
3678
col1
 
3679
2006-02-05
 
3680
select * from t2 order by col1;
 
3681
col1
 
3682
2006-01-25
 
3683
2006-02-05
 
3684
select * from t3 order by col1;
 
3685
col1
 
3686
2006-01-25
 
3687
2006-02-05
 
3688
select * from t4 order by colint;
 
3689
colint  col1
 
3690
1       2006-02-05
 
3691
3       2006-01-25
 
3692
4       2006-02-05
 
3693
select * from t5 order by colint;
 
3694
colint  col1
 
3695
1       2006-02-05
 
3696
3       2006-01-25
 
3697
4       2006-02-05
 
3698
insert into t1 values ('2006-01-17');
 
3699
insert into t2 values ('2006-01-17');
 
3700
insert into t3 values ('2006-01-17');
 
3701
insert into t4 values (60,'2006-01-17');
 
3702
insert into t5 values (60,'2006-01-17');
 
3703
insert into t6 values (60,'2006-01-17');
 
3704
select * from t1 order by col1;
 
3705
col1
 
3706
2006-01-17
 
3707
2006-02-05
 
3708
select * from t2 order by col1;
 
3709
col1
 
3710
2006-01-17
 
3711
2006-01-25
 
3712
2006-02-05
 
3713
select * from t3 order by col1;
 
3714
col1
 
3715
2006-01-17
 
3716
2006-01-25
 
3717
2006-02-05
 
3718
select * from t4 order by colint;
 
3719
colint  col1
 
3720
1       2006-02-05
 
3721
3       2006-01-25
 
3722
4       2006-02-05
 
3723
60      2006-01-17
 
3724
select * from t5 order by colint;
 
3725
colint  col1
 
3726
1       2006-02-05
 
3727
3       2006-01-25
 
3728
4       2006-02-05
 
3729
60      2006-01-17
 
3730
select * from t6 order by colint;
 
3731
colint  col1
 
3732
1       2006-02-05
 
3733
3       2006-01-25
 
3734
4       2006-02-05
 
3735
60      2006-01-17
 
3736
alter table t1 drop partition p0;
 
3737
alter table t2 drop partition p0;
 
3738
alter table t4 drop partition p0;
 
3739
alter table t5 drop partition p0;
 
3740
alter table t6 drop partition p0;
 
3741
select * from t1 order by col1;
 
3742
col1
 
3743
2006-01-17
 
3744
select * from t2 order by col1;
 
3745
col1
 
3746
2006-01-17
 
3747
2006-01-25
 
3748
select * from t3 order by col1;
 
3749
col1
 
3750
2006-01-17
 
3751
2006-01-25
 
3752
2006-02-05
 
3753
select * from t4 order by colint;
 
3754
colint  col1
 
3755
60      2006-01-17
 
3756
select * from t5 order by colint;
 
3757
colint  col1
 
3758
60      2006-01-17
 
3759
select * from t6 order by colint;
 
3760
colint  col1
 
3761
60      2006-01-17
 
3762
-------------------------------------------------------------------------
 
3763
---  Delete rows and partitions of tables with day(col1)
 
3764
-------------------------------------------------------------------------
 
3765
delete from t11 where col1='2006-01-17';
 
3766
delete from t22 where col1='2006-01-17';
 
3767
delete from t33 where col1='2006-01-17';
 
3768
delete from t44 where col1='2006-01-17';
 
3769
delete from t55 where col1='2006-01-17';
 
3770
delete from t66 where col1='2006-01-17';
 
3771
select * from t11 order by col1;
 
3772
col1
 
3773
2006-02-05
 
3774
select * from t22 order by col1;
 
3775
col1
 
3776
2006-01-25
 
3777
2006-02-05
 
3778
select * from t33 order by col1;
 
3779
col1
 
3780
2006-01-25
 
3781
2006-02-05
 
3782
select * from t44 order by colint;
 
3783
colint  col1
 
3784
1       2006-02-05
 
3785
3       2006-01-25
 
3786
4       2006-02-05
 
3787
select * from t55 order by colint;
 
3788
colint  col1
 
3789
1       2006-02-05
 
3790
3       2006-01-25
 
3791
4       2006-02-05
 
3792
insert into t11 values ('2006-01-17');
 
3793
insert into t22 values ('2006-01-17');
 
3794
insert into t33 values ('2006-01-17');
 
3795
insert into t44 values (60,'2006-01-17');
 
3796
insert into t55 values (60,'2006-01-17');
 
3797
insert into t66 values (60,'2006-01-17');
 
3798
select * from t11 order by col1;
 
3799
col1
 
3800
2006-01-17
 
3801
2006-02-05
 
3802
select * from t22 order by col1;
 
3803
col1
 
3804
2006-01-17
 
3805
2006-01-25
 
3806
2006-02-05
 
3807
select * from t33 order by col1;
 
3808
col1
 
3809
2006-01-17
 
3810
2006-01-25
 
3811
2006-02-05
 
3812
select * from t44 order by colint;
 
3813
colint  col1
 
3814
1       2006-02-05
 
3815
3       2006-01-25
 
3816
4       2006-02-05
 
3817
60      2006-01-17
 
3818
select * from t55 order by colint;
 
3819
colint  col1
 
3820
1       2006-02-05
 
3821
3       2006-01-25
 
3822
4       2006-02-05
 
3823
60      2006-01-17
 
3824
select * from t66 order by colint;
 
3825
colint  col1
 
3826
1       2006-02-05
 
3827
3       2006-01-25
 
3828
4       2006-02-05
 
3829
60      2006-01-17
 
3830
alter table t11 drop partition p0;
 
3831
alter table t22 drop partition p0;
 
3832
alter table t44 drop partition p0;
 
3833
alter table t55 drop partition p0;
 
3834
alter table t66 drop partition p0;
 
3835
select * from t11 order by col1;
 
3836
col1
 
3837
2006-01-17
 
3838
select * from t22 order by col1;
 
3839
col1
 
3840
2006-01-17
 
3841
2006-01-25
 
3842
select * from t33 order by col1;
 
3843
col1
 
3844
2006-01-17
 
3845
2006-01-25
 
3846
2006-02-05
 
3847
select * from t44 order by colint;
 
3848
colint  col1
 
3849
60      2006-01-17
 
3850
select * from t55 order by colint;
 
3851
colint  col1
 
3852
60      2006-01-17
 
3853
select * from t66 order by colint;
 
3854
colint  col1
 
3855
60      2006-01-17
 
3856
-------------------------
 
3857
---- some alter table end
 
3858
-------------------------
 
3859
drop table if exists t1 ;
 
3860
drop table if exists t2 ;
 
3861
drop table if exists t3 ;
 
3862
drop table if exists t4 ;
 
3863
drop table if exists t5 ;
 
3864
drop table if exists t6 ;
 
3865
drop table if exists t11 ;
 
3866
drop table if exists t22 ;
 
3867
drop table if exists t33 ;
 
3868
drop table if exists t44 ;
 
3869
drop table if exists t55 ;
 
3870
drop table if exists t66 ;
 
3871
-------------------------------------------------------------------------
 
3872
---  dayofmonth(col1)  in partition with coltype  date
 
3873
-------------------------------------------------------------------------
 
3874
drop table if exists t1 ;
 
3875
drop table if exists t2 ;
 
3876
drop table if exists t3 ;
 
3877
drop table if exists t4 ;
 
3878
drop table if exists t5 ;
 
3879
drop table if exists t6 ;
 
3880
-------------------------------------------------------------------------
 
3881
---  Create tables with dayofmonth(col1)
 
3882
-------------------------------------------------------------------------
 
3883
create table t1 (col1 date) engine='MYISAM' 
 
3884
partition by range(dayofmonth(col1)) 
 
3885
(partition p0 values less than (15),
 
3886
partition p1 values less than maxvalue);
 
3887
create table t2 (col1 date) engine='MYISAM' 
 
3888
partition by list(dayofmonth(col1)) 
 
3889
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
3890
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
3891
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
3892
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
3893
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
3894
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
3895
);
 
3896
create table t3 (col1 date) engine='MYISAM' 
 
3897
partition by hash(dayofmonth(col1));
 
3898
create table t4 (colint int, col1 date) engine='MYISAM' 
 
3899
partition by range(colint) 
 
3900
subpartition by hash(dayofmonth(col1)) subpartitions 2 
 
3901
(partition p0 values less than (15),
 
3902
partition p1 values less than maxvalue);
 
3903
create table t5 (colint int, col1 date) engine='MYISAM' 
 
3904
partition by list(colint)
 
3905
subpartition by hash(dayofmonth(col1)) subpartitions 2 
 
3906
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
3907
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
3908
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
3909
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
3910
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
3911
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
3912
);
 
3913
create table t6 (colint int, col1 date) engine='MYISAM' 
 
3914
partition by range(colint) 
 
3915
(partition p0 values less than (dayofmonth('2006-12-24')),
 
3916
partition p1 values less than maxvalue);
 
3917
-------------------------------------------------------------------------
 
3918
---  Access tables with dayofmonth(col1) 
 
3919
-------------------------------------------------------------------------
 
3920
insert into t1 values ('2006-02-03');
 
3921
insert into t1 values ('2006-01-17');
 
3922
insert into t2 values ('2006-02-03');
 
3923
insert into t2 values ('2006-01-17');
 
3924
insert into t2 values ('2006-01-25');
 
3925
insert into t3 values ('2006-02-03');
 
3926
insert into t3 values ('2006-01-17');
 
3927
insert into t3 values ('2006-01-25');
 
3928
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
 
3929
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
 
3930
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
 
3931
select dayofmonth(col1) from t1 order by col1;
 
3932
dayofmonth(col1)
 
3933
17
 
3934
3
 
3935
select * from t1 order by col1;
 
3936
col1
 
3937
2006-01-17
 
3938
2006-02-03
 
3939
select * from t2 order by col1;
 
3940
col1
 
3941
2006-01-17
 
3942
2006-01-25
 
3943
2006-02-03
 
3944
select * from t3 order by col1;
 
3945
col1
 
3946
2006-01-17
 
3947
2006-01-25
 
3948
2006-02-03
 
3949
select * from t4 order by colint;
 
3950
colint  col1
 
3951
1       2006-02-03
 
3952
2       2006-01-17
 
3953
3       2006-01-25
 
3954
4       2006-02-05
 
3955
select * from t5 order by colint;
 
3956
colint  col1
 
3957
1       2006-02-03
 
3958
2       2006-01-17
 
3959
3       2006-01-25
 
3960
4       2006-02-05
 
3961
select * from t6 order by colint;
 
3962
colint  col1
 
3963
1       2006-02-03
 
3964
2       2006-01-17
 
3965
3       2006-01-25
 
3966
4       2006-02-05
 
3967
update t1 set col1='2006-02-05' where col1='2006-02-03';
 
3968
update t2 set col1='2006-02-05' where col1='2006-02-03';
 
3969
update t3 set col1='2006-02-05' where col1='2006-02-03';
 
3970
update t4 set col1='2006-02-05' where col1='2006-02-03';
 
3971
update t5 set col1='2006-02-05' where col1='2006-02-03';
 
3972
update t6 set col1='2006-02-05' where col1='2006-02-03';
 
3973
select * from t1 order by col1;
 
3974
col1
 
3975
2006-01-17
 
3976
2006-02-05
 
3977
select * from t2 order by col1;
 
3978
col1
 
3979
2006-01-17
 
3980
2006-01-25
 
3981
2006-02-05
 
3982
select * from t3 order by col1;
 
3983
col1
 
3984
2006-01-17
 
3985
2006-01-25
 
3986
2006-02-05
 
3987
select * from t4 order by colint;
 
3988
colint  col1
 
3989
1       2006-02-05
 
3990
2       2006-01-17
 
3991
3       2006-01-25
 
3992
4       2006-02-05
 
3993
select * from t5 order by colint;
 
3994
colint  col1
 
3995
1       2006-02-05
 
3996
2       2006-01-17
 
3997
3       2006-01-25
 
3998
4       2006-02-05
 
3999
select * from t6 order by colint;
 
4000
colint  col1
 
4001
1       2006-02-05
 
4002
2       2006-01-17
 
4003
3       2006-01-25
 
4004
4       2006-02-05
 
4005
-------------------------------------------------------------------------
 
4006
---  Alter tables with dayofmonth(col1)
 
4007
-------------------------------------------------------------------------
 
4008
drop table if exists t11 ;
 
4009
drop table if exists t22 ;
 
4010
drop table if exists t33 ;
 
4011
drop table if exists t44 ;
 
4012
drop table if exists t55 ;
 
4013
drop table if exists t66 ;
 
4014
create table t11 engine='MYISAM' as select * from t1;
 
4015
create table t22 engine='MYISAM' as select * from t2;
 
4016
create table t33 engine='MYISAM' as select * from t3;
 
4017
create table t44 engine='MYISAM' as select * from t4;
 
4018
create table t55 engine='MYISAM' as select * from t5;
 
4019
create table t66 engine='MYISAM' as select * from t6;
 
4020
alter table t11
 
4021
partition by range(dayofmonth(col1)) 
 
4022
(partition p0 values less than (15),
 
4023
partition p1 values less than maxvalue);
 
4024
alter table t22
 
4025
partition by list(dayofmonth(col1)) 
 
4026
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
4027
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
4028
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
4029
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
4030
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
4031
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
4032
);
 
4033
alter table t33
 
4034
partition by hash(dayofmonth(col1));
 
4035
alter table t44
 
4036
partition by range(colint) 
 
4037
subpartition by hash(dayofmonth(col1)) subpartitions 2 
 
4038
(partition p0 values less than (15),
 
4039
partition p1 values less than maxvalue);
 
4040
alter table t55
 
4041
partition by list(colint)
 
4042
subpartition by hash(dayofmonth(col1)) subpartitions 2 
 
4043
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
4044
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
4045
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
4046
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
4047
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
4048
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
4049
);
 
4050
alter table t66
 
4051
partition by range(colint) 
 
4052
(partition p0 values less than (dayofmonth('2006-12-24')),
 
4053
partition p1 values less than maxvalue);
 
4054
select * from t11 order by col1;
 
4055
col1
 
4056
2006-01-17
 
4057
2006-02-05
 
4058
select * from t22 order by col1;
 
4059
col1
 
4060
2006-01-17
 
4061
2006-01-25
 
4062
2006-02-05
 
4063
select * from t33 order by col1;
 
4064
col1
 
4065
2006-01-17
 
4066
2006-01-25
 
4067
2006-02-05
 
4068
select * from t44 order by colint;
 
4069
colint  col1
 
4070
1       2006-02-05
 
4071
2       2006-01-17
 
4072
3       2006-01-25
 
4073
4       2006-02-05
 
4074
select * from t55 order by colint;
 
4075
colint  col1
 
4076
1       2006-02-05
 
4077
2       2006-01-17
 
4078
3       2006-01-25
 
4079
4       2006-02-05
 
4080
select * from t66 order by colint;
 
4081
colint  col1
 
4082
1       2006-02-05
 
4083
2       2006-01-17
 
4084
3       2006-01-25
 
4085
4       2006-02-05
 
4086
---------------------------
 
4087
---- some alter table begin
 
4088
---------------------------
 
4089
alter table t11
 
4090
reorganize partition p0,p1 into
 
4091
(partition s1 values less than maxvalue);
 
4092
select * from t11 order by col1;
 
4093
col1
 
4094
2006-01-17
 
4095
2006-02-05
 
4096
alter table t11
 
4097
reorganize partition s1 into
 
4098
(partition p0 values less than (15),
 
4099
partition p1 values less than maxvalue);
 
4100
select * from t11 order by col1;
 
4101
col1
 
4102
2006-01-17
 
4103
2006-02-05
 
4104
alter table t55
 
4105
partition by list(colint)
 
4106
subpartition by hash(dayofmonth(col1)) subpartitions 5 
 
4107
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
4108
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
4109
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
4110
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
4111
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
4112
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
4113
);
 
4114
show create table t55;
 
4115
Table   Create Table
 
4116
t55     CREATE TABLE `t55` (
 
4117
  `colint` int(11) DEFAULT NULL,
 
4118
  `col1` date DEFAULT NULL
 
4119
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofmonth(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
 
4120
select * from t55 order by colint;
 
4121
colint  col1
 
4122
1       2006-02-05
 
4123
2       2006-01-17
 
4124
3       2006-01-25
 
4125
4       2006-02-05
 
4126
alter table t66
 
4127
reorganize partition p0,p1 into
 
4128
(partition s1 values less than maxvalue);
 
4129
select * from t66 order by colint;
 
4130
colint  col1
 
4131
1       2006-02-05
 
4132
2       2006-01-17
 
4133
3       2006-01-25
 
4134
4       2006-02-05
 
4135
alter table t66
 
4136
reorganize partition s1 into
 
4137
(partition p0 values less than (dayofmonth('2006-12-24')),
 
4138
partition p1 values less than maxvalue);
 
4139
select * from t66 order by colint;
 
4140
colint  col1
 
4141
1       2006-02-05
 
4142
2       2006-01-17
 
4143
3       2006-01-25
 
4144
4       2006-02-05
 
4145
alter table t66
 
4146
reorganize partition p0,p1 into
 
4147
(partition s1 values less than maxvalue);
 
4148
select * from t66 order by colint;
 
4149
colint  col1
 
4150
1       2006-02-05
 
4151
2       2006-01-17
 
4152
3       2006-01-25
 
4153
4       2006-02-05
 
4154
alter table t66
 
4155
reorganize partition s1 into
 
4156
(partition p0 values less than (dayofmonth('2006-12-24')),
 
4157
partition p1 values less than maxvalue);
 
4158
select * from t66 order by colint;
 
4159
colint  col1
 
4160
1       2006-02-05
 
4161
2       2006-01-17
 
4162
3       2006-01-25
 
4163
4       2006-02-05
 
4164
-------------------------------------------------------------------------
 
4165
---  Delete rows and partitions of tables with dayofmonth(col1)
 
4166
-------------------------------------------------------------------------
 
4167
delete from t1 where col1='2006-01-17';
 
4168
delete from t2 where col1='2006-01-17';
 
4169
delete from t3 where col1='2006-01-17';
 
4170
delete from t4 where col1='2006-01-17';
 
4171
delete from t5 where col1='2006-01-17';
 
4172
delete from t6 where col1='2006-01-17';
 
4173
select * from t1 order by col1;
 
4174
col1
 
4175
2006-02-05
 
4176
select * from t2 order by col1;
 
4177
col1
 
4178
2006-01-25
 
4179
2006-02-05
 
4180
select * from t3 order by col1;
 
4181
col1
 
4182
2006-01-25
 
4183
2006-02-05
 
4184
select * from t4 order by colint;
 
4185
colint  col1
 
4186
1       2006-02-05
 
4187
3       2006-01-25
 
4188
4       2006-02-05
 
4189
select * from t5 order by colint;
 
4190
colint  col1
 
4191
1       2006-02-05
 
4192
3       2006-01-25
 
4193
4       2006-02-05
 
4194
insert into t1 values ('2006-01-17');
 
4195
insert into t2 values ('2006-01-17');
 
4196
insert into t3 values ('2006-01-17');
 
4197
insert into t4 values (60,'2006-01-17');
 
4198
insert into t5 values (60,'2006-01-17');
 
4199
insert into t6 values (60,'2006-01-17');
 
4200
select * from t1 order by col1;
 
4201
col1
 
4202
2006-01-17
 
4203
2006-02-05
 
4204
select * from t2 order by col1;
 
4205
col1
 
4206
2006-01-17
 
4207
2006-01-25
 
4208
2006-02-05
 
4209
select * from t3 order by col1;
 
4210
col1
 
4211
2006-01-17
 
4212
2006-01-25
 
4213
2006-02-05
 
4214
select * from t4 order by colint;
 
4215
colint  col1
 
4216
1       2006-02-05
 
4217
3       2006-01-25
 
4218
4       2006-02-05
 
4219
60      2006-01-17
 
4220
select * from t5 order by colint;
 
4221
colint  col1
 
4222
1       2006-02-05
 
4223
3       2006-01-25
 
4224
4       2006-02-05
 
4225
60      2006-01-17
 
4226
select * from t6 order by colint;
 
4227
colint  col1
 
4228
1       2006-02-05
 
4229
3       2006-01-25
 
4230
4       2006-02-05
 
4231
60      2006-01-17
 
4232
alter table t1 drop partition p0;
 
4233
alter table t2 drop partition p0;
 
4234
alter table t4 drop partition p0;
 
4235
alter table t5 drop partition p0;
 
4236
alter table t6 drop partition p0;
 
4237
select * from t1 order by col1;
 
4238
col1
 
4239
2006-01-17
 
4240
select * from t2 order by col1;
 
4241
col1
 
4242
2006-01-17
 
4243
2006-01-25
 
4244
select * from t3 order by col1;
 
4245
col1
 
4246
2006-01-17
 
4247
2006-01-25
 
4248
2006-02-05
 
4249
select * from t4 order by colint;
 
4250
colint  col1
 
4251
60      2006-01-17
 
4252
select * from t5 order by colint;
 
4253
colint  col1
 
4254
60      2006-01-17
 
4255
select * from t6 order by colint;
 
4256
colint  col1
 
4257
60      2006-01-17
 
4258
-------------------------------------------------------------------------
 
4259
---  Delete rows and partitions of tables with dayofmonth(col1)
 
4260
-------------------------------------------------------------------------
 
4261
delete from t11 where col1='2006-01-17';
 
4262
delete from t22 where col1='2006-01-17';
 
4263
delete from t33 where col1='2006-01-17';
 
4264
delete from t44 where col1='2006-01-17';
 
4265
delete from t55 where col1='2006-01-17';
 
4266
delete from t66 where col1='2006-01-17';
 
4267
select * from t11 order by col1;
 
4268
col1
 
4269
2006-02-05
 
4270
select * from t22 order by col1;
 
4271
col1
 
4272
2006-01-25
 
4273
2006-02-05
 
4274
select * from t33 order by col1;
 
4275
col1
 
4276
2006-01-25
 
4277
2006-02-05
 
4278
select * from t44 order by colint;
 
4279
colint  col1
 
4280
1       2006-02-05
 
4281
3       2006-01-25
 
4282
4       2006-02-05
 
4283
select * from t55 order by colint;
 
4284
colint  col1
 
4285
1       2006-02-05
 
4286
3       2006-01-25
 
4287
4       2006-02-05
 
4288
insert into t11 values ('2006-01-17');
 
4289
insert into t22 values ('2006-01-17');
 
4290
insert into t33 values ('2006-01-17');
 
4291
insert into t44 values (60,'2006-01-17');
 
4292
insert into t55 values (60,'2006-01-17');
 
4293
insert into t66 values (60,'2006-01-17');
 
4294
select * from t11 order by col1;
 
4295
col1
 
4296
2006-01-17
 
4297
2006-02-05
 
4298
select * from t22 order by col1;
 
4299
col1
 
4300
2006-01-17
 
4301
2006-01-25
 
4302
2006-02-05
 
4303
select * from t33 order by col1;
 
4304
col1
 
4305
2006-01-17
 
4306
2006-01-25
 
4307
2006-02-05
 
4308
select * from t44 order by colint;
 
4309
colint  col1
 
4310
1       2006-02-05
 
4311
3       2006-01-25
 
4312
4       2006-02-05
 
4313
60      2006-01-17
 
4314
select * from t55 order by colint;
 
4315
colint  col1
 
4316
1       2006-02-05
 
4317
3       2006-01-25
 
4318
4       2006-02-05
 
4319
60      2006-01-17
 
4320
select * from t66 order by colint;
 
4321
colint  col1
 
4322
1       2006-02-05
 
4323
3       2006-01-25
 
4324
4       2006-02-05
 
4325
60      2006-01-17
 
4326
alter table t11 drop partition p0;
 
4327
alter table t22 drop partition p0;
 
4328
alter table t44 drop partition p0;
 
4329
alter table t55 drop partition p0;
 
4330
alter table t66 drop partition p0;
 
4331
select * from t11 order by col1;
 
4332
col1
 
4333
2006-01-17
 
4334
select * from t22 order by col1;
 
4335
col1
 
4336
2006-01-17
 
4337
2006-01-25
 
4338
select * from t33 order by col1;
 
4339
col1
 
4340
2006-01-17
 
4341
2006-01-25
 
4342
2006-02-05
 
4343
select * from t44 order by colint;
 
4344
colint  col1
 
4345
60      2006-01-17
 
4346
select * from t55 order by colint;
 
4347
colint  col1
 
4348
60      2006-01-17
 
4349
select * from t66 order by colint;
 
4350
colint  col1
 
4351
60      2006-01-17
 
4352
-------------------------
 
4353
---- some alter table end
 
4354
-------------------------
 
4355
drop table if exists t1 ;
 
4356
drop table if exists t2 ;
 
4357
drop table if exists t3 ;
 
4358
drop table if exists t4 ;
 
4359
drop table if exists t5 ;
 
4360
drop table if exists t6 ;
 
4361
drop table if exists t11 ;
 
4362
drop table if exists t22 ;
 
4363
drop table if exists t33 ;
 
4364
drop table if exists t44 ;
 
4365
drop table if exists t55 ;
 
4366
drop table if exists t66 ;
 
4367
-------------------------------------------------------------------------
 
4368
---  dayofweek(col1)  in partition with coltype  date
 
4369
-------------------------------------------------------------------------
 
4370
drop table if exists t1 ;
 
4371
drop table if exists t2 ;
 
4372
drop table if exists t3 ;
 
4373
drop table if exists t4 ;
 
4374
drop table if exists t5 ;
 
4375
drop table if exists t6 ;
 
4376
-------------------------------------------------------------------------
 
4377
---  Create tables with dayofweek(col1)
 
4378
-------------------------------------------------------------------------
 
4379
create table t1 (col1 date) engine='MYISAM' 
 
4380
partition by range(dayofweek(col1)) 
 
4381
(partition p0 values less than (15),
 
4382
partition p1 values less than maxvalue);
 
4383
create table t2 (col1 date) engine='MYISAM' 
 
4384
partition by list(dayofweek(col1)) 
 
4385
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
4386
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
4387
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
4388
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
4389
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
4390
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
4391
);
 
4392
create table t3 (col1 date) engine='MYISAM' 
 
4393
partition by hash(dayofweek(col1));
 
4394
create table t4 (colint int, col1 date) engine='MYISAM' 
 
4395
partition by range(colint) 
 
4396
subpartition by hash(dayofweek(col1)) subpartitions 2 
 
4397
(partition p0 values less than (15),
 
4398
partition p1 values less than maxvalue);
 
4399
create table t5 (colint int, col1 date) engine='MYISAM' 
 
4400
partition by list(colint)
 
4401
subpartition by hash(dayofweek(col1)) subpartitions 2 
 
4402
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
4403
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
4404
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
4405
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
4406
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
4407
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
4408
);
 
4409
create table t6 (colint int, col1 date) engine='MYISAM' 
 
4410
partition by range(colint) 
 
4411
(partition p0 values less than (dayofweek('2006-12-24')),
 
4412
partition p1 values less than maxvalue);
 
4413
-------------------------------------------------------------------------
 
4414
---  Access tables with dayofweek(col1) 
 
4415
-------------------------------------------------------------------------
 
4416
insert into t1 values ('2006-01-03');
 
4417
insert into t1 values ('2006-02-17');
 
4418
insert into t2 values ('2006-01-03');
 
4419
insert into t2 values ('2006-02-17');
 
4420
insert into t2 values ('2006-01-25');
 
4421
insert into t3 values ('2006-01-03');
 
4422
insert into t3 values ('2006-02-17');
 
4423
insert into t3 values ('2006-01-25');
 
4424
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
 
4425
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
 
4426
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
 
4427
select dayofweek(col1) from t1 order by col1;
 
4428
dayofweek(col1)
 
4429
3
 
4430
6
 
4431
select * from t1 order by col1;
 
4432
col1
 
4433
2006-01-03
 
4434
2006-02-17
 
4435
select * from t2 order by col1;
 
4436
col1
 
4437
2006-01-03
 
4438
2006-01-25
 
4439
2006-02-17
 
4440
select * from t3 order by col1;
 
4441
col1
 
4442
2006-01-03
 
4443
2006-01-25
 
4444
2006-02-17
 
4445
select * from t4 order by colint;
 
4446
colint  col1
 
4447
1       2006-02-03
 
4448
2       2006-01-17
 
4449
3       2006-01-25
 
4450
4       2006-02-05
 
4451
select * from t5 order by colint;
 
4452
colint  col1
 
4453
1       2006-02-03
 
4454
2       2006-01-17
 
4455
3       2006-01-25
 
4456
4       2006-02-05
 
4457
select * from t6 order by colint;
 
4458
colint  col1
 
4459
1       2006-02-03
 
4460
2       2006-01-17
 
4461
3       2006-01-25
 
4462
4       2006-02-05
 
4463
update t1 set col1='2006-02-05' where col1='2006-01-03';
 
4464
update t2 set col1='2006-02-05' where col1='2006-01-03';
 
4465
update t3 set col1='2006-02-05' where col1='2006-01-03';
 
4466
update t4 set col1='2006-02-05' where col1='2006-01-03';
 
4467
update t5 set col1='2006-02-05' where col1='2006-01-03';
 
4468
update t6 set col1='2006-02-05' where col1='2006-01-03';
 
4469
select * from t1 order by col1;
 
4470
col1
 
4471
2006-02-05
 
4472
2006-02-17
 
4473
select * from t2 order by col1;
 
4474
col1
 
4475
2006-01-25
 
4476
2006-02-05
 
4477
2006-02-17
 
4478
select * from t3 order by col1;
 
4479
col1
 
4480
2006-01-25
 
4481
2006-02-05
 
4482
2006-02-17
 
4483
select * from t4 order by colint;
 
4484
colint  col1
 
4485
1       2006-02-03
 
4486
2       2006-01-17
 
4487
3       2006-01-25
 
4488
4       2006-02-05
 
4489
select * from t5 order by colint;
 
4490
colint  col1
 
4491
1       2006-02-03
 
4492
2       2006-01-17
 
4493
3       2006-01-25
 
4494
4       2006-02-05
 
4495
select * from t6 order by colint;
 
4496
colint  col1
 
4497
1       2006-02-03
 
4498
2       2006-01-17
 
4499
3       2006-01-25
 
4500
4       2006-02-05
 
4501
-------------------------------------------------------------------------
 
4502
---  Alter tables with dayofweek(col1)
 
4503
-------------------------------------------------------------------------
 
4504
drop table if exists t11 ;
 
4505
drop table if exists t22 ;
 
4506
drop table if exists t33 ;
 
4507
drop table if exists t44 ;
 
4508
drop table if exists t55 ;
 
4509
drop table if exists t66 ;
 
4510
create table t11 engine='MYISAM' as select * from t1;
 
4511
create table t22 engine='MYISAM' as select * from t2;
 
4512
create table t33 engine='MYISAM' as select * from t3;
 
4513
create table t44 engine='MYISAM' as select * from t4;
 
4514
create table t55 engine='MYISAM' as select * from t5;
 
4515
create table t66 engine='MYISAM' as select * from t6;
 
4516
alter table t11
 
4517
partition by range(dayofweek(col1)) 
 
4518
(partition p0 values less than (15),
 
4519
partition p1 values less than maxvalue);
 
4520
alter table t22
 
4521
partition by list(dayofweek(col1)) 
 
4522
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
4523
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
4524
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
4525
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
4526
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
4527
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
4528
);
 
4529
alter table t33
 
4530
partition by hash(dayofweek(col1));
 
4531
alter table t44
 
4532
partition by range(colint) 
 
4533
subpartition by hash(dayofweek(col1)) subpartitions 2 
 
4534
(partition p0 values less than (15),
 
4535
partition p1 values less than maxvalue);
 
4536
alter table t55
 
4537
partition by list(colint)
 
4538
subpartition by hash(dayofweek(col1)) subpartitions 2 
 
4539
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
4540
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
4541
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
4542
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
4543
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
4544
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
4545
);
 
4546
alter table t66
 
4547
partition by range(colint) 
 
4548
(partition p0 values less than (dayofweek('2006-12-24')),
 
4549
partition p1 values less than maxvalue);
 
4550
select * from t11 order by col1;
 
4551
col1
 
4552
2006-02-05
 
4553
2006-02-17
 
4554
select * from t22 order by col1;
 
4555
col1
 
4556
2006-01-25
 
4557
2006-02-05
 
4558
2006-02-17
 
4559
select * from t33 order by col1;
 
4560
col1
 
4561
2006-01-25
 
4562
2006-02-05
 
4563
2006-02-17
 
4564
select * from t44 order by colint;
 
4565
colint  col1
 
4566
1       2006-02-03
 
4567
2       2006-01-17
 
4568
3       2006-01-25
 
4569
4       2006-02-05
 
4570
select * from t55 order by colint;
 
4571
colint  col1
 
4572
1       2006-02-03
 
4573
2       2006-01-17
 
4574
3       2006-01-25
 
4575
4       2006-02-05
 
4576
select * from t66 order by colint;
 
4577
colint  col1
 
4578
1       2006-02-03
 
4579
2       2006-01-17
 
4580
3       2006-01-25
 
4581
4       2006-02-05
 
4582
---------------------------
 
4583
---- some alter table begin
 
4584
---------------------------
 
4585
alter table t11
 
4586
reorganize partition p0,p1 into
 
4587
(partition s1 values less than maxvalue);
 
4588
select * from t11 order by col1;
 
4589
col1
 
4590
2006-02-05
 
4591
2006-02-17
 
4592
alter table t11
 
4593
reorganize partition s1 into
 
4594
(partition p0 values less than (15),
 
4595
partition p1 values less than maxvalue);
 
4596
select * from t11 order by col1;
 
4597
col1
 
4598
2006-02-05
 
4599
2006-02-17
 
4600
alter table t55
 
4601
partition by list(colint)
 
4602
subpartition by hash(dayofweek(col1)) subpartitions 5 
 
4603
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
4604
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
4605
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
4606
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
4607
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
4608
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
4609
);
 
4610
show create table t55;
 
4611
Table   Create Table
 
4612
t55     CREATE TABLE `t55` (
 
4613
  `colint` int(11) DEFAULT NULL,
 
4614
  `col1` date DEFAULT NULL
 
4615
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofweek(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
 
4616
select * from t55 order by colint;
 
4617
colint  col1
 
4618
1       2006-02-03
 
4619
2       2006-01-17
 
4620
3       2006-01-25
 
4621
4       2006-02-05
 
4622
alter table t66
 
4623
reorganize partition p0,p1 into
 
4624
(partition s1 values less than maxvalue);
 
4625
select * from t66 order by colint;
 
4626
colint  col1
 
4627
1       2006-02-03
 
4628
2       2006-01-17
 
4629
3       2006-01-25
 
4630
4       2006-02-05
 
4631
alter table t66
 
4632
reorganize partition s1 into
 
4633
(partition p0 values less than (dayofweek('2006-12-24')),
 
4634
partition p1 values less than maxvalue);
 
4635
select * from t66 order by colint;
 
4636
colint  col1
 
4637
1       2006-02-03
 
4638
2       2006-01-17
 
4639
3       2006-01-25
 
4640
4       2006-02-05
 
4641
alter table t66
 
4642
reorganize partition p0,p1 into
 
4643
(partition s1 values less than maxvalue);
 
4644
select * from t66 order by colint;
 
4645
colint  col1
 
4646
1       2006-02-03
 
4647
2       2006-01-17
 
4648
3       2006-01-25
 
4649
4       2006-02-05
 
4650
alter table t66
 
4651
reorganize partition s1 into
 
4652
(partition p0 values less than (dayofweek('2006-12-24')),
 
4653
partition p1 values less than maxvalue);
 
4654
select * from t66 order by colint;
 
4655
colint  col1
 
4656
1       2006-02-03
 
4657
2       2006-01-17
 
4658
3       2006-01-25
 
4659
4       2006-02-05
 
4660
-------------------------------------------------------------------------
 
4661
---  Delete rows and partitions of tables with dayofweek(col1)
 
4662
-------------------------------------------------------------------------
 
4663
delete from t1 where col1='2006-02-17';
 
4664
delete from t2 where col1='2006-02-17';
 
4665
delete from t3 where col1='2006-02-17';
 
4666
delete from t4 where col1='2006-02-17';
 
4667
delete from t5 where col1='2006-02-17';
 
4668
delete from t6 where col1='2006-02-17';
 
4669
select * from t1 order by col1;
 
4670
col1
 
4671
2006-02-05
 
4672
select * from t2 order by col1;
 
4673
col1
 
4674
2006-01-25
 
4675
2006-02-05
 
4676
select * from t3 order by col1;
 
4677
col1
 
4678
2006-01-25
 
4679
2006-02-05
 
4680
select * from t4 order by colint;
 
4681
colint  col1
 
4682
1       2006-02-03
 
4683
2       2006-01-17
 
4684
3       2006-01-25
 
4685
4       2006-02-05
 
4686
select * from t5 order by colint;
 
4687
colint  col1
 
4688
1       2006-02-03
 
4689
2       2006-01-17
 
4690
3       2006-01-25
 
4691
4       2006-02-05
 
4692
insert into t1 values ('2006-02-17');
 
4693
insert into t2 values ('2006-02-17');
 
4694
insert into t3 values ('2006-02-17');
 
4695
insert into t4 values (60,'2006-02-17');
 
4696
insert into t5 values (60,'2006-02-17');
 
4697
insert into t6 values (60,'2006-02-17');
 
4698
select * from t1 order by col1;
 
4699
col1
 
4700
2006-02-05
 
4701
2006-02-17
 
4702
select * from t2 order by col1;
 
4703
col1
 
4704
2006-01-25
 
4705
2006-02-05
 
4706
2006-02-17
 
4707
select * from t3 order by col1;
 
4708
col1
 
4709
2006-01-25
 
4710
2006-02-05
 
4711
2006-02-17
 
4712
select * from t4 order by colint;
 
4713
colint  col1
 
4714
1       2006-02-03
 
4715
2       2006-01-17
 
4716
3       2006-01-25
 
4717
4       2006-02-05
 
4718
60      2006-02-17
 
4719
select * from t5 order by colint;
 
4720
colint  col1
 
4721
1       2006-02-03
 
4722
2       2006-01-17
 
4723
3       2006-01-25
 
4724
4       2006-02-05
 
4725
60      2006-02-17
 
4726
select * from t6 order by colint;
 
4727
colint  col1
 
4728
1       2006-02-03
 
4729
2       2006-01-17
 
4730
3       2006-01-25
 
4731
4       2006-02-05
 
4732
60      2006-02-17
 
4733
alter table t1 drop partition p0;
 
4734
alter table t2 drop partition p0;
 
4735
alter table t4 drop partition p0;
 
4736
alter table t5 drop partition p0;
 
4737
alter table t6 drop partition p0;
 
4738
select * from t1 order by col1;
 
4739
col1
 
4740
select * from t2 order by col1;
 
4741
col1
 
4742
select * from t3 order by col1;
 
4743
col1
 
4744
2006-01-25
 
4745
2006-02-05
 
4746
2006-02-17
 
4747
select * from t4 order by colint;
 
4748
colint  col1
 
4749
60      2006-02-17
 
4750
select * from t5 order by colint;
 
4751
colint  col1
 
4752
60      2006-02-17
 
4753
select * from t6 order by colint;
 
4754
colint  col1
 
4755
1       2006-02-03
 
4756
2       2006-01-17
 
4757
3       2006-01-25
 
4758
4       2006-02-05
 
4759
60      2006-02-17
 
4760
-------------------------------------------------------------------------
 
4761
---  Delete rows and partitions of tables with dayofweek(col1)
 
4762
-------------------------------------------------------------------------
 
4763
delete from t11 where col1='2006-02-17';
 
4764
delete from t22 where col1='2006-02-17';
 
4765
delete from t33 where col1='2006-02-17';
 
4766
delete from t44 where col1='2006-02-17';
 
4767
delete from t55 where col1='2006-02-17';
 
4768
delete from t66 where col1='2006-02-17';
 
4769
select * from t11 order by col1;
 
4770
col1
 
4771
2006-02-05
 
4772
select * from t22 order by col1;
 
4773
col1
 
4774
2006-01-25
 
4775
2006-02-05
 
4776
select * from t33 order by col1;
 
4777
col1
 
4778
2006-01-25
 
4779
2006-02-05
 
4780
select * from t44 order by colint;
 
4781
colint  col1
 
4782
1       2006-02-03
 
4783
2       2006-01-17
 
4784
3       2006-01-25
 
4785
4       2006-02-05
 
4786
select * from t55 order by colint;
 
4787
colint  col1
 
4788
1       2006-02-03
 
4789
2       2006-01-17
 
4790
3       2006-01-25
 
4791
4       2006-02-05
 
4792
insert into t11 values ('2006-02-17');
 
4793
insert into t22 values ('2006-02-17');
 
4794
insert into t33 values ('2006-02-17');
 
4795
insert into t44 values (60,'2006-02-17');
 
4796
insert into t55 values (60,'2006-02-17');
 
4797
insert into t66 values (60,'2006-02-17');
 
4798
select * from t11 order by col1;
 
4799
col1
 
4800
2006-02-05
 
4801
2006-02-17
 
4802
select * from t22 order by col1;
 
4803
col1
 
4804
2006-01-25
 
4805
2006-02-05
 
4806
2006-02-17
 
4807
select * from t33 order by col1;
 
4808
col1
 
4809
2006-01-25
 
4810
2006-02-05
 
4811
2006-02-17
 
4812
select * from t44 order by colint;
 
4813
colint  col1
 
4814
1       2006-02-03
 
4815
2       2006-01-17
 
4816
3       2006-01-25
 
4817
4       2006-02-05
 
4818
60      2006-02-17
 
4819
select * from t55 order by colint;
 
4820
colint  col1
 
4821
1       2006-02-03
 
4822
2       2006-01-17
 
4823
3       2006-01-25
 
4824
4       2006-02-05
 
4825
60      2006-02-17
 
4826
select * from t66 order by colint;
 
4827
colint  col1
 
4828
1       2006-02-03
 
4829
2       2006-01-17
 
4830
3       2006-01-25
 
4831
4       2006-02-05
 
4832
60      2006-02-17
 
4833
alter table t11 drop partition p0;
 
4834
alter table t22 drop partition p0;
 
4835
alter table t44 drop partition p0;
 
4836
alter table t55 drop partition p0;
 
4837
alter table t66 drop partition p0;
 
4838
select * from t11 order by col1;
 
4839
col1
 
4840
select * from t22 order by col1;
 
4841
col1
 
4842
select * from t33 order by col1;
 
4843
col1
 
4844
2006-01-25
 
4845
2006-02-05
 
4846
2006-02-17
 
4847
select * from t44 order by colint;
 
4848
colint  col1
 
4849
60      2006-02-17
 
4850
select * from t55 order by colint;
 
4851
colint  col1
 
4852
60      2006-02-17
 
4853
select * from t66 order by colint;
 
4854
colint  col1
 
4855
1       2006-02-03
 
4856
2       2006-01-17
 
4857
3       2006-01-25
 
4858
4       2006-02-05
 
4859
60      2006-02-17
 
4860
-------------------------
 
4861
---- some alter table end
 
4862
-------------------------
 
4863
drop table if exists t1 ;
 
4864
drop table if exists t2 ;
 
4865
drop table if exists t3 ;
 
4866
drop table if exists t4 ;
 
4867
drop table if exists t5 ;
 
4868
drop table if exists t6 ;
 
4869
drop table if exists t11 ;
 
4870
drop table if exists t22 ;
 
4871
drop table if exists t33 ;
 
4872
drop table if exists t44 ;
 
4873
drop table if exists t55 ;
 
4874
drop table if exists t66 ;
 
4875
-------------------------------------------------------------------------
 
4876
---  dayofyear(col1)  in partition with coltype  date
 
4877
-------------------------------------------------------------------------
 
4878
drop table if exists t1 ;
 
4879
drop table if exists t2 ;
 
4880
drop table if exists t3 ;
 
4881
drop table if exists t4 ;
 
4882
drop table if exists t5 ;
 
4883
drop table if exists t6 ;
 
4884
-------------------------------------------------------------------------
 
4885
---  Create tables with dayofyear(col1)
 
4886
-------------------------------------------------------------------------
 
4887
create table t1 (col1 date) engine='MYISAM' 
 
4888
partition by range(dayofyear(col1)) 
 
4889
(partition p0 values less than (15),
 
4890
partition p1 values less than maxvalue);
 
4891
create table t2 (col1 date) engine='MYISAM' 
 
4892
partition by list(dayofyear(col1)) 
 
4893
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
4894
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
4895
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
4896
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
4897
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
4898
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
4899
);
 
4900
create table t3 (col1 date) engine='MYISAM' 
 
4901
partition by hash(dayofyear(col1));
 
4902
create table t4 (colint int, col1 date) engine='MYISAM' 
 
4903
partition by range(colint) 
 
4904
subpartition by hash(dayofyear(col1)) subpartitions 2 
 
4905
(partition p0 values less than (15),
 
4906
partition p1 values less than maxvalue);
 
4907
create table t5 (colint int, col1 date) engine='MYISAM' 
 
4908
partition by list(colint)
 
4909
subpartition by hash(dayofyear(col1)) subpartitions 2 
 
4910
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
4911
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
4912
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
4913
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
4914
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
4915
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
4916
);
 
4917
create table t6 (colint int, col1 date) engine='MYISAM' 
 
4918
partition by range(colint) 
 
4919
(partition p0 values less than (dayofyear('2006-12-25')),
 
4920
partition p1 values less than maxvalue);
 
4921
-------------------------------------------------------------------------
 
4922
---  Access tables with dayofyear(col1) 
 
4923
-------------------------------------------------------------------------
 
4924
insert into t1 values ('2006-01-03');
 
4925
insert into t1 values ('2006-01-17');
 
4926
insert into t2 values ('2006-01-03');
 
4927
insert into t2 values ('2006-01-17');
 
4928
insert into t2 values ('2006-02-25');
 
4929
insert into t3 values ('2006-01-03');
 
4930
insert into t3 values ('2006-01-17');
 
4931
insert into t3 values ('2006-02-25');
 
4932
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
 
4933
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
 
4934
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
 
4935
select dayofyear(col1) from t1 order by col1;
 
4936
dayofyear(col1)
 
4937
3
 
4938
17
 
4939
select * from t1 order by col1;
 
4940
col1
 
4941
2006-01-03
 
4942
2006-01-17
 
4943
select * from t2 order by col1;
 
4944
col1
 
4945
2006-01-03
 
4946
2006-01-17
 
4947
2006-02-25
 
4948
select * from t3 order by col1;
 
4949
col1
 
4950
2006-01-03
 
4951
2006-01-17
 
4952
2006-02-25
 
4953
select * from t4 order by colint;
 
4954
colint  col1
 
4955
1       2006-02-03
 
4956
2       2006-01-17
 
4957
3       2006-01-25
 
4958
4       2006-02-05
 
4959
select * from t5 order by colint;
 
4960
colint  col1
 
4961
1       2006-02-03
 
4962
2       2006-01-17
 
4963
3       2006-01-25
 
4964
4       2006-02-05
 
4965
select * from t6 order by colint;
 
4966
colint  col1
 
4967
1       2006-02-03
 
4968
2       2006-01-17
 
4969
3       2006-01-25
 
4970
4       2006-02-05
 
4971
update t1 set col1='2006-02-05' where col1='2006-01-03';
 
4972
update t2 set col1='2006-02-05' where col1='2006-01-03';
 
4973
update t3 set col1='2006-02-05' where col1='2006-01-03';
 
4974
update t4 set col1='2006-02-05' where col1='2006-01-03';
 
4975
update t5 set col1='2006-02-05' where col1='2006-01-03';
 
4976
update t6 set col1='2006-02-05' where col1='2006-01-03';
 
4977
select * from t1 order by col1;
 
4978
col1
 
4979
2006-01-17
 
4980
2006-02-05
 
4981
select * from t2 order by col1;
 
4982
col1
 
4983
2006-01-17
 
4984
2006-02-05
 
4985
2006-02-25
 
4986
select * from t3 order by col1;
 
4987
col1
 
4988
2006-01-17
 
4989
2006-02-05
 
4990
2006-02-25
 
4991
select * from t4 order by colint;
 
4992
colint  col1
 
4993
1       2006-02-03
 
4994
2       2006-01-17
 
4995
3       2006-01-25
 
4996
4       2006-02-05
 
4997
select * from t5 order by colint;
 
4998
colint  col1
 
4999
1       2006-02-03
 
5000
2       2006-01-17
 
5001
3       2006-01-25
 
5002
4       2006-02-05
 
5003
select * from t6 order by colint;
 
5004
colint  col1
 
5005
1       2006-02-03
 
5006
2       2006-01-17
 
5007
3       2006-01-25
 
5008
4       2006-02-05
 
5009
-------------------------------------------------------------------------
 
5010
---  Alter tables with dayofyear(col1)
 
5011
-------------------------------------------------------------------------
 
5012
drop table if exists t11 ;
 
5013
drop table if exists t22 ;
 
5014
drop table if exists t33 ;
 
5015
drop table if exists t44 ;
 
5016
drop table if exists t55 ;
 
5017
drop table if exists t66 ;
 
5018
create table t11 engine='MYISAM' as select * from t1;
 
5019
create table t22 engine='MYISAM' as select * from t2;
 
5020
create table t33 engine='MYISAM' as select * from t3;
 
5021
create table t44 engine='MYISAM' as select * from t4;
 
5022
create table t55 engine='MYISAM' as select * from t5;
 
5023
create table t66 engine='MYISAM' as select * from t6;
 
5024
alter table t11
 
5025
partition by range(dayofyear(col1)) 
 
5026
(partition p0 values less than (15),
 
5027
partition p1 values less than maxvalue);
 
5028
alter table t22
 
5029
partition by list(dayofyear(col1)) 
 
5030
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
5031
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
5032
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
5033
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
5034
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
5035
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
5036
);
 
5037
alter table t33
 
5038
partition by hash(dayofyear(col1));
 
5039
alter table t44
 
5040
partition by range(colint) 
 
5041
subpartition by hash(dayofyear(col1)) subpartitions 2 
 
5042
(partition p0 values less than (15),
 
5043
partition p1 values less than maxvalue);
 
5044
alter table t55
 
5045
partition by list(colint)
 
5046
subpartition by hash(dayofyear(col1)) subpartitions 2 
 
5047
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
5048
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
5049
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
5050
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
5051
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
5052
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
5053
);
 
5054
alter table t66
 
5055
partition by range(colint) 
 
5056
(partition p0 values less than (dayofyear('2006-12-25')),
 
5057
partition p1 values less than maxvalue);
 
5058
select * from t11 order by col1;
 
5059
col1
 
5060
2006-01-17
 
5061
2006-02-05
 
5062
select * from t22 order by col1;
 
5063
col1
 
5064
2006-01-17
 
5065
2006-02-05
 
5066
2006-02-25
 
5067
select * from t33 order by col1;
 
5068
col1
 
5069
2006-01-17
 
5070
2006-02-05
 
5071
2006-02-25
 
5072
select * from t44 order by colint;
 
5073
colint  col1
 
5074
1       2006-02-03
 
5075
2       2006-01-17
 
5076
3       2006-01-25
 
5077
4       2006-02-05
 
5078
select * from t55 order by colint;
 
5079
colint  col1
 
5080
1       2006-02-03
 
5081
2       2006-01-17
 
5082
3       2006-01-25
 
5083
4       2006-02-05
 
5084
select * from t66 order by colint;
 
5085
colint  col1
 
5086
1       2006-02-03
 
5087
2       2006-01-17
 
5088
3       2006-01-25
 
5089
4       2006-02-05
 
5090
---------------------------
 
5091
---- some alter table begin
 
5092
---------------------------
 
5093
alter table t11
 
5094
reorganize partition p0,p1 into
 
5095
(partition s1 values less than maxvalue);
 
5096
select * from t11 order by col1;
 
5097
col1
 
5098
2006-01-17
 
5099
2006-02-05
 
5100
alter table t11
 
5101
reorganize partition s1 into
 
5102
(partition p0 values less than (15),
 
5103
partition p1 values less than maxvalue);
 
5104
select * from t11 order by col1;
 
5105
col1
 
5106
2006-01-17
 
5107
2006-02-05
 
5108
alter table t55
 
5109
partition by list(colint)
 
5110
subpartition by hash(dayofyear(col1)) subpartitions 5 
 
5111
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
5112
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
5113
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
5114
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
5115
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
5116
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
5117
);
 
5118
show create table t55;
 
5119
Table   Create Table
 
5120
t55     CREATE TABLE `t55` (
 
5121
  `colint` int(11) DEFAULT NULL,
 
5122
  `col1` date DEFAULT NULL
 
5123
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
 
5124
select * from t55 order by colint;
 
5125
colint  col1
 
5126
1       2006-02-03
 
5127
2       2006-01-17
 
5128
3       2006-01-25
 
5129
4       2006-02-05
 
5130
alter table t66
 
5131
reorganize partition p0,p1 into
 
5132
(partition s1 values less than maxvalue);
 
5133
select * from t66 order by colint;
 
5134
colint  col1
 
5135
1       2006-02-03
 
5136
2       2006-01-17
 
5137
3       2006-01-25
 
5138
4       2006-02-05
 
5139
alter table t66
 
5140
reorganize partition s1 into
 
5141
(partition p0 values less than (dayofyear('2006-12-25')),
 
5142
partition p1 values less than maxvalue);
 
5143
select * from t66 order by colint;
 
5144
colint  col1
 
5145
1       2006-02-03
 
5146
2       2006-01-17
 
5147
3       2006-01-25
 
5148
4       2006-02-05
 
5149
alter table t66
 
5150
reorganize partition p0,p1 into
 
5151
(partition s1 values less than maxvalue);
 
5152
select * from t66 order by colint;
 
5153
colint  col1
 
5154
1       2006-02-03
 
5155
2       2006-01-17
 
5156
3       2006-01-25
 
5157
4       2006-02-05
 
5158
alter table t66
 
5159
reorganize partition s1 into
 
5160
(partition p0 values less than (dayofyear('2006-12-25')),
 
5161
partition p1 values less than maxvalue);
 
5162
select * from t66 order by colint;
 
5163
colint  col1
 
5164
1       2006-02-03
 
5165
2       2006-01-17
 
5166
3       2006-01-25
 
5167
4       2006-02-05
 
5168
-------------------------------------------------------------------------
 
5169
---  Delete rows and partitions of tables with dayofyear(col1)
 
5170
-------------------------------------------------------------------------
 
5171
delete from t1 where col1='2006-01-17';
 
5172
delete from t2 where col1='2006-01-17';
 
5173
delete from t3 where col1='2006-01-17';
 
5174
delete from t4 where col1='2006-01-17';
 
5175
delete from t5 where col1='2006-01-17';
 
5176
delete from t6 where col1='2006-01-17';
 
5177
select * from t1 order by col1;
 
5178
col1
 
5179
2006-02-05
 
5180
select * from t2 order by col1;
 
5181
col1
 
5182
2006-02-05
 
5183
2006-02-25
 
5184
select * from t3 order by col1;
 
5185
col1
 
5186
2006-02-05
 
5187
2006-02-25
 
5188
select * from t4 order by colint;
 
5189
colint  col1
 
5190
1       2006-02-03
 
5191
3       2006-01-25
 
5192
4       2006-02-05
 
5193
select * from t5 order by colint;
 
5194
colint  col1
 
5195
1       2006-02-03
 
5196
3       2006-01-25
 
5197
4       2006-02-05
 
5198
insert into t1 values ('2006-01-17');
 
5199
insert into t2 values ('2006-01-17');
 
5200
insert into t3 values ('2006-01-17');
 
5201
insert into t4 values (60,'2006-01-17');
 
5202
insert into t5 values (60,'2006-01-17');
 
5203
insert into t6 values (60,'2006-01-17');
 
5204
select * from t1 order by col1;
 
5205
col1
 
5206
2006-01-17
 
5207
2006-02-05
 
5208
select * from t2 order by col1;
 
5209
col1
 
5210
2006-01-17
 
5211
2006-02-05
 
5212
2006-02-25
 
5213
select * from t3 order by col1;
 
5214
col1
 
5215
2006-01-17
 
5216
2006-02-05
 
5217
2006-02-25
 
5218
select * from t4 order by colint;
 
5219
colint  col1
 
5220
1       2006-02-03
 
5221
3       2006-01-25
 
5222
4       2006-02-05
 
5223
60      2006-01-17
 
5224
select * from t5 order by colint;
 
5225
colint  col1
 
5226
1       2006-02-03
 
5227
3       2006-01-25
 
5228
4       2006-02-05
 
5229
60      2006-01-17
 
5230
select * from t6 order by colint;
 
5231
colint  col1
 
5232
1       2006-02-03
 
5233
3       2006-01-25
 
5234
4       2006-02-05
 
5235
60      2006-01-17
 
5236
alter table t1 drop partition p0;
 
5237
alter table t2 drop partition p0;
 
5238
alter table t4 drop partition p0;
 
5239
alter table t5 drop partition p0;
 
5240
alter table t6 drop partition p0;
 
5241
select * from t1 order by col1;
 
5242
col1
 
5243
2006-01-17
 
5244
2006-02-05
 
5245
select * from t2 order by col1;
 
5246
col1
 
5247
2006-01-17
 
5248
2006-02-05
 
5249
2006-02-25
 
5250
select * from t3 order by col1;
 
5251
col1
 
5252
2006-01-17
 
5253
2006-02-05
 
5254
2006-02-25
 
5255
select * from t4 order by colint;
 
5256
colint  col1
 
5257
60      2006-01-17
 
5258
select * from t5 order by colint;
 
5259
colint  col1
 
5260
60      2006-01-17
 
5261
select * from t6 order by colint;
 
5262
colint  col1
 
5263
-------------------------------------------------------------------------
 
5264
---  Delete rows and partitions of tables with dayofyear(col1)
 
5265
-------------------------------------------------------------------------
 
5266
delete from t11 where col1='2006-01-17';
 
5267
delete from t22 where col1='2006-01-17';
 
5268
delete from t33 where col1='2006-01-17';
 
5269
delete from t44 where col1='2006-01-17';
 
5270
delete from t55 where col1='2006-01-17';
 
5271
delete from t66 where col1='2006-01-17';
 
5272
select * from t11 order by col1;
 
5273
col1
 
5274
2006-02-05
 
5275
select * from t22 order by col1;
 
5276
col1
 
5277
2006-02-05
 
5278
2006-02-25
 
5279
select * from t33 order by col1;
 
5280
col1
 
5281
2006-02-05
 
5282
2006-02-25
 
5283
select * from t44 order by colint;
 
5284
colint  col1
 
5285
1       2006-02-03
 
5286
3       2006-01-25
 
5287
4       2006-02-05
 
5288
select * from t55 order by colint;
 
5289
colint  col1
 
5290
1       2006-02-03
 
5291
3       2006-01-25
 
5292
4       2006-02-05
 
5293
insert into t11 values ('2006-01-17');
 
5294
insert into t22 values ('2006-01-17');
 
5295
insert into t33 values ('2006-01-17');
 
5296
insert into t44 values (60,'2006-01-17');
 
5297
insert into t55 values (60,'2006-01-17');
 
5298
insert into t66 values (60,'2006-01-17');
 
5299
select * from t11 order by col1;
 
5300
col1
 
5301
2006-01-17
 
5302
2006-02-05
 
5303
select * from t22 order by col1;
 
5304
col1
 
5305
2006-01-17
 
5306
2006-02-05
 
5307
2006-02-25
 
5308
select * from t33 order by col1;
 
5309
col1
 
5310
2006-01-17
 
5311
2006-02-05
 
5312
2006-02-25
 
5313
select * from t44 order by colint;
 
5314
colint  col1
 
5315
1       2006-02-03
 
5316
3       2006-01-25
 
5317
4       2006-02-05
 
5318
60      2006-01-17
 
5319
select * from t55 order by colint;
 
5320
colint  col1
 
5321
1       2006-02-03
 
5322
3       2006-01-25
 
5323
4       2006-02-05
 
5324
60      2006-01-17
 
5325
select * from t66 order by colint;
 
5326
colint  col1
 
5327
1       2006-02-03
 
5328
3       2006-01-25
 
5329
4       2006-02-05
 
5330
60      2006-01-17
 
5331
alter table t11 drop partition p0;
 
5332
alter table t22 drop partition p0;
 
5333
alter table t44 drop partition p0;
 
5334
alter table t55 drop partition p0;
 
5335
alter table t66 drop partition p0;
 
5336
select * from t11 order by col1;
 
5337
col1
 
5338
2006-01-17
 
5339
2006-02-05
 
5340
select * from t22 order by col1;
 
5341
col1
 
5342
2006-01-17
 
5343
2006-02-05
 
5344
2006-02-25
 
5345
select * from t33 order by col1;
 
5346
col1
 
5347
2006-01-17
 
5348
2006-02-05
 
5349
2006-02-25
 
5350
select * from t44 order by colint;
 
5351
colint  col1
 
5352
60      2006-01-17
 
5353
select * from t55 order by colint;
 
5354
colint  col1
 
5355
60      2006-01-17
 
5356
select * from t66 order by colint;
 
5357
colint  col1
 
5358
-------------------------
 
5359
---- some alter table end
 
5360
-------------------------
 
5361
drop table if exists t1 ;
 
5362
drop table if exists t2 ;
 
5363
drop table if exists t3 ;
 
5364
drop table if exists t4 ;
 
5365
drop table if exists t5 ;
 
5366
drop table if exists t6 ;
 
5367
drop table if exists t11 ;
 
5368
drop table if exists t22 ;
 
5369
drop table if exists t33 ;
 
5370
drop table if exists t44 ;
 
5371
drop table if exists t55 ;
 
5372
drop table if exists t66 ;
 
5373
-------------------------------------------------------------------------
 
5374
---  dayofyear(col1)  in partition with coltype  char(30)
 
5375
-------------------------------------------------------------------------
 
5376
drop table if exists t1 ;
 
5377
drop table if exists t2 ;
 
5378
drop table if exists t3 ;
 
5379
drop table if exists t4 ;
 
5380
drop table if exists t5 ;
 
5381
drop table if exists t6 ;
 
5382
-------------------------------------------------------------------------
 
5383
---  Create tables with dayofyear(col1)
 
5384
-------------------------------------------------------------------------
 
5385
create table t1 (col1 char(30)) engine='MYISAM' 
 
5386
partition by range(dayofyear(col1)) 
 
5387
(partition p0 values less than (15),
 
5388
partition p1 values less than maxvalue);
 
5389
create table t2 (col1 char(30)) engine='MYISAM' 
 
5390
partition by list(dayofyear(col1)) 
 
5391
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
5392
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
5393
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
5394
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
5395
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
5396
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
5397
);
 
5398
create table t3 (col1 char(30)) engine='MYISAM' 
 
5399
partition by hash(dayofyear(col1));
 
5400
create table t4 (colint int, col1 char(30)) engine='MYISAM' 
 
5401
partition by range(colint) 
 
5402
subpartition by hash(dayofyear(col1)) subpartitions 2 
 
5403
(partition p0 values less than (15),
 
5404
partition p1 values less than maxvalue);
 
5405
create table t5 (colint int, col1 char(30)) engine='MYISAM' 
 
5406
partition by list(colint)
 
5407
subpartition by hash(dayofyear(col1)) subpartitions 2 
 
5408
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
5409
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
5410
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
5411
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
5412
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
5413
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
5414
);
 
5415
create table t6 (colint int, col1 char(30)) engine='MYISAM' 
 
5416
partition by range(colint) 
 
5417
(partition p0 values less than (dayofyear('2006-12-25')),
 
5418
partition p1 values less than maxvalue);
 
5419
-------------------------------------------------------------------------
 
5420
---  Access tables with dayofyear(col1) 
 
5421
-------------------------------------------------------------------------
 
5422
insert into t1 values ('2006-01-03');
 
5423
insert into t1 values ('2006-01-17');
 
5424
insert into t2 values ('2006-01-03');
 
5425
insert into t2 values ('2006-01-17');
 
5426
insert into t2 values ('2006-02-25');
 
5427
insert into t3 values ('2006-01-03');
 
5428
insert into t3 values ('2006-01-17');
 
5429
insert into t3 values ('2006-02-25');
 
5430
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
 
5431
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
 
5432
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
 
5433
select dayofyear(col1) from t1 order by col1;
 
5434
dayofyear(col1)
 
5435
3
 
5436
17
 
5437
select * from t1 order by col1;
 
5438
col1
 
5439
2006-01-03
 
5440
2006-01-17
 
5441
select * from t2 order by col1;
 
5442
col1
 
5443
2006-01-03
 
5444
2006-01-17
 
5445
2006-02-25
 
5446
select * from t3 order by col1;
 
5447
col1
 
5448
2006-01-03
 
5449
2006-01-17
 
5450
2006-02-25
 
5451
select * from t4 order by colint;
 
5452
colint  col1
 
5453
1       2006-02-03
 
5454
2       2006-01-17
 
5455
3       2006-01-25
 
5456
4       2006-02-05
 
5457
select * from t5 order by colint;
 
5458
colint  col1
 
5459
1       2006-02-03
 
5460
2       2006-01-17
 
5461
3       2006-01-25
 
5462
4       2006-02-05
 
5463
select * from t6 order by colint;
 
5464
colint  col1
 
5465
1       2006-02-03
 
5466
2       2006-01-17
 
5467
3       2006-01-25
 
5468
4       2006-02-05
 
5469
update t1 set col1='2006-02-05' where col1='2006-01-03';
 
5470
update t2 set col1='2006-02-05' where col1='2006-01-03';
 
5471
update t3 set col1='2006-02-05' where col1='2006-01-03';
 
5472
update t4 set col1='2006-02-05' where col1='2006-01-03';
 
5473
update t5 set col1='2006-02-05' where col1='2006-01-03';
 
5474
update t6 set col1='2006-02-05' where col1='2006-01-03';
 
5475
select * from t1 order by col1;
 
5476
col1
 
5477
2006-01-17
 
5478
2006-02-05
 
5479
select * from t2 order by col1;
 
5480
col1
 
5481
2006-01-17
 
5482
2006-02-05
 
5483
2006-02-25
 
5484
select * from t3 order by col1;
 
5485
col1
 
5486
2006-01-17
 
5487
2006-02-05
 
5488
2006-02-25
 
5489
select * from t4 order by colint;
 
5490
colint  col1
 
5491
1       2006-02-03
 
5492
2       2006-01-17
 
5493
3       2006-01-25
 
5494
4       2006-02-05
 
5495
select * from t5 order by colint;
 
5496
colint  col1
 
5497
1       2006-02-03
 
5498
2       2006-01-17
 
5499
3       2006-01-25
 
5500
4       2006-02-05
 
5501
select * from t6 order by colint;
 
5502
colint  col1
 
5503
1       2006-02-03
 
5504
2       2006-01-17
 
5505
3       2006-01-25
 
5506
4       2006-02-05
 
5507
-------------------------------------------------------------------------
 
5508
---  Alter tables with dayofyear(col1)
 
5509
-------------------------------------------------------------------------
 
5510
drop table if exists t11 ;
 
5511
drop table if exists t22 ;
 
5512
drop table if exists t33 ;
 
5513
drop table if exists t44 ;
 
5514
drop table if exists t55 ;
 
5515
drop table if exists t66 ;
 
5516
create table t11 engine='MYISAM' as select * from t1;
 
5517
create table t22 engine='MYISAM' as select * from t2;
 
5518
create table t33 engine='MYISAM' as select * from t3;
 
5519
create table t44 engine='MYISAM' as select * from t4;
 
5520
create table t55 engine='MYISAM' as select * from t5;
 
5521
create table t66 engine='MYISAM' as select * from t6;
 
5522
alter table t11
 
5523
partition by range(dayofyear(col1)) 
 
5524
(partition p0 values less than (15),
 
5525
partition p1 values less than maxvalue);
 
5526
alter table t22
 
5527
partition by list(dayofyear(col1)) 
 
5528
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
5529
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
5530
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
5531
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
5532
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
5533
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
5534
);
 
5535
alter table t33
 
5536
partition by hash(dayofyear(col1));
 
5537
alter table t44
 
5538
partition by range(colint) 
 
5539
subpartition by hash(dayofyear(col1)) subpartitions 2 
 
5540
(partition p0 values less than (15),
 
5541
partition p1 values less than maxvalue);
 
5542
alter table t55
 
5543
partition by list(colint)
 
5544
subpartition by hash(dayofyear(col1)) subpartitions 2 
 
5545
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
5546
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
5547
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
5548
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
5549
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
5550
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
5551
);
 
5552
alter table t66
 
5553
partition by range(colint) 
 
5554
(partition p0 values less than (dayofyear('2006-12-25')),
 
5555
partition p1 values less than maxvalue);
 
5556
select * from t11 order by col1;
 
5557
col1
 
5558
2006-01-17
 
5559
2006-02-05
 
5560
select * from t22 order by col1;
 
5561
col1
 
5562
2006-01-17
 
5563
2006-02-05
 
5564
2006-02-25
 
5565
select * from t33 order by col1;
 
5566
col1
 
5567
2006-01-17
 
5568
2006-02-05
 
5569
2006-02-25
 
5570
select * from t44 order by colint;
 
5571
colint  col1
 
5572
1       2006-02-03
 
5573
2       2006-01-17
 
5574
3       2006-01-25
 
5575
4       2006-02-05
 
5576
select * from t55 order by colint;
 
5577
colint  col1
 
5578
1       2006-02-03
 
5579
2       2006-01-17
 
5580
3       2006-01-25
 
5581
4       2006-02-05
 
5582
select * from t66 order by colint;
 
5583
colint  col1
 
5584
1       2006-02-03
 
5585
2       2006-01-17
 
5586
3       2006-01-25
 
5587
4       2006-02-05
 
5588
---------------------------
 
5589
---- some alter table begin
 
5590
---------------------------
 
5591
alter table t11
 
5592
reorganize partition p0,p1 into
 
5593
(partition s1 values less than maxvalue);
 
5594
select * from t11 order by col1;
 
5595
col1
 
5596
2006-01-17
 
5597
2006-02-05
 
5598
alter table t11
 
5599
reorganize partition s1 into
 
5600
(partition p0 values less than (15),
 
5601
partition p1 values less than maxvalue);
 
5602
select * from t11 order by col1;
 
5603
col1
 
5604
2006-01-17
 
5605
2006-02-05
 
5606
alter table t55
 
5607
partition by list(colint)
 
5608
subpartition by hash(dayofyear(col1)) subpartitions 5 
 
5609
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
5610
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
5611
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
5612
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
5613
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
5614
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
5615
);
 
5616
show create table t55;
 
5617
Table   Create Table
 
5618
t55     CREATE TABLE `t55` (
 
5619
  `colint` int(11) DEFAULT NULL,
 
5620
  `col1` char(30) DEFAULT NULL
 
5621
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
 
5622
select * from t55 order by colint;
 
5623
colint  col1
 
5624
1       2006-02-03
 
5625
2       2006-01-17
 
5626
3       2006-01-25
 
5627
4       2006-02-05
 
5628
alter table t66
 
5629
reorganize partition p0,p1 into
 
5630
(partition s1 values less than maxvalue);
 
5631
select * from t66 order by colint;
 
5632
colint  col1
 
5633
1       2006-02-03
 
5634
2       2006-01-17
 
5635
3       2006-01-25
 
5636
4       2006-02-05
 
5637
alter table t66
 
5638
reorganize partition s1 into
 
5639
(partition p0 values less than (dayofyear('2006-12-25')),
 
5640
partition p1 values less than maxvalue);
 
5641
select * from t66 order by colint;
 
5642
colint  col1
 
5643
1       2006-02-03
 
5644
2       2006-01-17
 
5645
3       2006-01-25
 
5646
4       2006-02-05
 
5647
alter table t66
 
5648
reorganize partition p0,p1 into
 
5649
(partition s1 values less than maxvalue);
 
5650
select * from t66 order by colint;
 
5651
colint  col1
 
5652
1       2006-02-03
 
5653
2       2006-01-17
 
5654
3       2006-01-25
 
5655
4       2006-02-05
 
5656
alter table t66
 
5657
reorganize partition s1 into
 
5658
(partition p0 values less than (dayofyear('2006-12-25')),
 
5659
partition p1 values less than maxvalue);
 
5660
select * from t66 order by colint;
 
5661
colint  col1
 
5662
1       2006-02-03
 
5663
2       2006-01-17
 
5664
3       2006-01-25
 
5665
4       2006-02-05
 
5666
-------------------------------------------------------------------------
 
5667
---  Delete rows and partitions of tables with dayofyear(col1)
 
5668
-------------------------------------------------------------------------
 
5669
delete from t1 where col1='2006-01-17';
 
5670
delete from t2 where col1='2006-01-17';
 
5671
delete from t3 where col1='2006-01-17';
 
5672
delete from t4 where col1='2006-01-17';
 
5673
delete from t5 where col1='2006-01-17';
 
5674
delete from t6 where col1='2006-01-17';
 
5675
select * from t1 order by col1;
 
5676
col1
 
5677
2006-02-05
 
5678
select * from t2 order by col1;
 
5679
col1
 
5680
2006-02-05
 
5681
2006-02-25
 
5682
select * from t3 order by col1;
 
5683
col1
 
5684
2006-02-05
 
5685
2006-02-25
 
5686
select * from t4 order by colint;
 
5687
colint  col1
 
5688
1       2006-02-03
 
5689
3       2006-01-25
 
5690
4       2006-02-05
 
5691
select * from t5 order by colint;
 
5692
colint  col1
 
5693
1       2006-02-03
 
5694
3       2006-01-25
 
5695
4       2006-02-05
 
5696
insert into t1 values ('2006-01-17');
 
5697
insert into t2 values ('2006-01-17');
 
5698
insert into t3 values ('2006-01-17');
 
5699
insert into t4 values (60,'2006-01-17');
 
5700
insert into t5 values (60,'2006-01-17');
 
5701
insert into t6 values (60,'2006-01-17');
 
5702
select * from t1 order by col1;
 
5703
col1
 
5704
2006-01-17
 
5705
2006-02-05
 
5706
select * from t2 order by col1;
 
5707
col1
 
5708
2006-01-17
 
5709
2006-02-05
 
5710
2006-02-25
 
5711
select * from t3 order by col1;
 
5712
col1
 
5713
2006-01-17
 
5714
2006-02-05
 
5715
2006-02-25
 
5716
select * from t4 order by colint;
 
5717
colint  col1
 
5718
1       2006-02-03
 
5719
3       2006-01-25
 
5720
4       2006-02-05
 
5721
60      2006-01-17
 
5722
select * from t5 order by colint;
 
5723
colint  col1
 
5724
1       2006-02-03
 
5725
3       2006-01-25
 
5726
4       2006-02-05
 
5727
60      2006-01-17
 
5728
select * from t6 order by colint;
 
5729
colint  col1
 
5730
1       2006-02-03
 
5731
3       2006-01-25
 
5732
4       2006-02-05
 
5733
60      2006-01-17
 
5734
alter table t1 drop partition p0;
 
5735
alter table t2 drop partition p0;
 
5736
alter table t4 drop partition p0;
 
5737
alter table t5 drop partition p0;
 
5738
alter table t6 drop partition p0;
 
5739
select * from t1 order by col1;
 
5740
col1
 
5741
2006-01-17
 
5742
2006-02-05
 
5743
select * from t2 order by col1;
 
5744
col1
 
5745
2006-01-17
 
5746
2006-02-05
 
5747
2006-02-25
 
5748
select * from t3 order by col1;
 
5749
col1
 
5750
2006-01-17
 
5751
2006-02-05
 
5752
2006-02-25
 
5753
select * from t4 order by colint;
 
5754
colint  col1
 
5755
60      2006-01-17
 
5756
select * from t5 order by colint;
 
5757
colint  col1
 
5758
60      2006-01-17
 
5759
select * from t6 order by colint;
 
5760
colint  col1
 
5761
-------------------------------------------------------------------------
 
5762
---  Delete rows and partitions of tables with dayofyear(col1)
 
5763
-------------------------------------------------------------------------
 
5764
delete from t11 where col1='2006-01-17';
 
5765
delete from t22 where col1='2006-01-17';
 
5766
delete from t33 where col1='2006-01-17';
 
5767
delete from t44 where col1='2006-01-17';
 
5768
delete from t55 where col1='2006-01-17';
 
5769
delete from t66 where col1='2006-01-17';
 
5770
select * from t11 order by col1;
 
5771
col1
 
5772
2006-02-05
 
5773
select * from t22 order by col1;
 
5774
col1
 
5775
2006-02-05
 
5776
2006-02-25
 
5777
select * from t33 order by col1;
 
5778
col1
 
5779
2006-02-05
 
5780
2006-02-25
 
5781
select * from t44 order by colint;
 
5782
colint  col1
 
5783
1       2006-02-03
 
5784
3       2006-01-25
 
5785
4       2006-02-05
 
5786
select * from t55 order by colint;
 
5787
colint  col1
 
5788
1       2006-02-03
 
5789
3       2006-01-25
 
5790
4       2006-02-05
 
5791
insert into t11 values ('2006-01-17');
 
5792
insert into t22 values ('2006-01-17');
 
5793
insert into t33 values ('2006-01-17');
 
5794
insert into t44 values (60,'2006-01-17');
 
5795
insert into t55 values (60,'2006-01-17');
 
5796
insert into t66 values (60,'2006-01-17');
 
5797
select * from t11 order by col1;
 
5798
col1
 
5799
2006-01-17
 
5800
2006-02-05
 
5801
select * from t22 order by col1;
 
5802
col1
 
5803
2006-01-17
 
5804
2006-02-05
 
5805
2006-02-25
 
5806
select * from t33 order by col1;
 
5807
col1
 
5808
2006-01-17
 
5809
2006-02-05
 
5810
2006-02-25
 
5811
select * from t44 order by colint;
 
5812
colint  col1
 
5813
1       2006-02-03
 
5814
3       2006-01-25
 
5815
4       2006-02-05
 
5816
60      2006-01-17
 
5817
select * from t55 order by colint;
 
5818
colint  col1
 
5819
1       2006-02-03
 
5820
3       2006-01-25
 
5821
4       2006-02-05
 
5822
60      2006-01-17
 
5823
select * from t66 order by colint;
 
5824
colint  col1
 
5825
1       2006-02-03
 
5826
3       2006-01-25
 
5827
4       2006-02-05
 
5828
60      2006-01-17
 
5829
alter table t11 drop partition p0;
 
5830
alter table t22 drop partition p0;
 
5831
alter table t44 drop partition p0;
 
5832
alter table t55 drop partition p0;
 
5833
alter table t66 drop partition p0;
 
5834
select * from t11 order by col1;
 
5835
col1
 
5836
2006-01-17
 
5837
2006-02-05
 
5838
select * from t22 order by col1;
 
5839
col1
 
5840
2006-01-17
 
5841
2006-02-05
 
5842
2006-02-25
 
5843
select * from t33 order by col1;
 
5844
col1
 
5845
2006-01-17
 
5846
2006-02-05
 
5847
2006-02-25
 
5848
select * from t44 order by colint;
 
5849
colint  col1
 
5850
60      2006-01-17
 
5851
select * from t55 order by colint;
 
5852
colint  col1
 
5853
60      2006-01-17
 
5854
select * from t66 order by colint;
 
5855
colint  col1
 
5856
-------------------------
 
5857
---- some alter table end
 
5858
-------------------------
 
5859
drop table if exists t1 ;
 
5860
drop table if exists t2 ;
 
5861
drop table if exists t3 ;
 
5862
drop table if exists t4 ;
 
5863
drop table if exists t5 ;
 
5864
drop table if exists t6 ;
 
5865
drop table if exists t11 ;
 
5866
drop table if exists t22 ;
 
5867
drop table if exists t33 ;
 
5868
drop table if exists t44 ;
 
5869
drop table if exists t55 ;
 
5870
drop table if exists t66 ;
 
5871
-------------------------------------------------------------------------
 
5872
---  extract(month from col1)  in partition with coltype  date
 
5873
-------------------------------------------------------------------------
 
5874
drop table if exists t1 ;
 
5875
drop table if exists t2 ;
 
5876
drop table if exists t3 ;
 
5877
drop table if exists t4 ;
 
5878
drop table if exists t5 ;
 
5879
drop table if exists t6 ;
 
5880
-------------------------------------------------------------------------
 
5881
---  Create tables with extract(month from col1)
 
5882
-------------------------------------------------------------------------
 
5883
create table t1 (col1 date) engine='MYISAM' 
 
5884
partition by range(extract(month from col1)) 
 
5885
(partition p0 values less than (15),
 
5886
partition p1 values less than maxvalue);
 
5887
create table t2 (col1 date) engine='MYISAM' 
 
5888
partition by list(extract(month from col1)) 
 
5889
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
5890
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
5891
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
5892
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
5893
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
5894
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
5895
);
 
5896
create table t3 (col1 date) engine='MYISAM' 
 
5897
partition by hash(extract(month from col1));
 
5898
create table t4 (colint int, col1 date) engine='MYISAM' 
 
5899
partition by range(colint) 
 
5900
subpartition by hash(extract(month from col1)) subpartitions 2 
 
5901
(partition p0 values less than (15),
 
5902
partition p1 values less than maxvalue);
 
5903
create table t5 (colint int, col1 date) engine='MYISAM' 
 
5904
partition by list(colint)
 
5905
subpartition by hash(extract(month from col1)) subpartitions 2 
 
5906
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
5907
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
5908
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
5909
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
5910
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
5911
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
5912
);
 
5913
create table t6 (colint int, col1 date) engine='MYISAM' 
 
5914
partition by range(colint) 
 
5915
(partition p0 values less than (extract(year from '1998-11-23')),
 
5916
partition p1 values less than maxvalue);
 
5917
-------------------------------------------------------------------------
 
5918
---  Access tables with extract(month from col1) 
 
5919
-------------------------------------------------------------------------
 
5920
insert into t1 values ('2006-01-03');
 
5921
insert into t1 values ('2006-02-17');
 
5922
insert into t2 values ('2006-01-03');
 
5923
insert into t2 values ('2006-02-17');
 
5924
insert into t2 values ('2006-01-25');
 
5925
insert into t3 values ('2006-01-03');
 
5926
insert into t3 values ('2006-02-17');
 
5927
insert into t3 values ('2006-01-25');
 
5928
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
 
5929
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
 
5930
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
 
5931
select extract(month from col1) from t1 order by col1;
 
5932
extract(month from col1)
 
5933
1
 
5934
2
 
5935
select * from t1 order by col1;
 
5936
col1
 
5937
2006-01-03
 
5938
2006-02-17
 
5939
select * from t2 order by col1;
 
5940
col1
 
5941
2006-01-03
 
5942
2006-01-25
 
5943
2006-02-17
 
5944
select * from t3 order by col1;
 
5945
col1
 
5946
2006-01-03
 
5947
2006-01-25
 
5948
2006-02-17
 
5949
select * from t4 order by colint;
 
5950
colint  col1
 
5951
1       2006-02-03
 
5952
2       2006-01-17
 
5953
3       2006-01-25
 
5954
4       2006-02-05
 
5955
select * from t5 order by colint;
 
5956
colint  col1
 
5957
1       2006-02-03
 
5958
2       2006-01-17
 
5959
3       2006-01-25
 
5960
4       2006-02-05
 
5961
select * from t6 order by colint;
 
5962
colint  col1
 
5963
1       2006-02-03
 
5964
2       2006-01-17
 
5965
3       2006-01-25
 
5966
4       2006-02-05
 
5967
update t1 set col1='2006-02-05' where col1='2006-01-03';
 
5968
update t2 set col1='2006-02-05' where col1='2006-01-03';
 
5969
update t3 set col1='2006-02-05' where col1='2006-01-03';
 
5970
update t4 set col1='2006-02-05' where col1='2006-01-03';
 
5971
update t5 set col1='2006-02-05' where col1='2006-01-03';
 
5972
update t6 set col1='2006-02-05' where col1='2006-01-03';
 
5973
select * from t1 order by col1;
 
5974
col1
 
5975
2006-02-05
 
5976
2006-02-17
 
5977
select * from t2 order by col1;
 
5978
col1
 
5979
2006-01-25
 
5980
2006-02-05
 
5981
2006-02-17
 
5982
select * from t3 order by col1;
 
5983
col1
 
5984
2006-01-25
 
5985
2006-02-05
 
5986
2006-02-17
 
5987
select * from t4 order by colint;
 
5988
colint  col1
 
5989
1       2006-02-03
 
5990
2       2006-01-17
 
5991
3       2006-01-25
 
5992
4       2006-02-05
 
5993
select * from t5 order by colint;
 
5994
colint  col1
 
5995
1       2006-02-03
 
5996
2       2006-01-17
 
5997
3       2006-01-25
 
5998
4       2006-02-05
 
5999
select * from t6 order by colint;
 
6000
colint  col1
 
6001
1       2006-02-03
 
6002
2       2006-01-17
 
6003
3       2006-01-25
 
6004
4       2006-02-05
 
6005
-------------------------------------------------------------------------
 
6006
---  Alter tables with extract(month from col1)
 
6007
-------------------------------------------------------------------------
 
6008
drop table if exists t11 ;
 
6009
drop table if exists t22 ;
 
6010
drop table if exists t33 ;
 
6011
drop table if exists t44 ;
 
6012
drop table if exists t55 ;
 
6013
drop table if exists t66 ;
 
6014
create table t11 engine='MYISAM' as select * from t1;
 
6015
create table t22 engine='MYISAM' as select * from t2;
 
6016
create table t33 engine='MYISAM' as select * from t3;
 
6017
create table t44 engine='MYISAM' as select * from t4;
 
6018
create table t55 engine='MYISAM' as select * from t5;
 
6019
create table t66 engine='MYISAM' as select * from t6;
 
6020
alter table t11
 
6021
partition by range(extract(month from col1)) 
 
6022
(partition p0 values less than (15),
 
6023
partition p1 values less than maxvalue);
 
6024
alter table t22
 
6025
partition by list(extract(month from col1)) 
 
6026
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
6027
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
6028
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
6029
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
6030
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
6031
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
6032
);
 
6033
alter table t33
 
6034
partition by hash(extract(month from col1));
 
6035
alter table t44
 
6036
partition by range(colint) 
 
6037
subpartition by hash(extract(month from col1)) subpartitions 2 
 
6038
(partition p0 values less than (15),
 
6039
partition p1 values less than maxvalue);
 
6040
alter table t55
 
6041
partition by list(colint)
 
6042
subpartition by hash(extract(month from col1)) subpartitions 2 
 
6043
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
6044
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
6045
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
6046
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
6047
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
6048
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
6049
);
 
6050
alter table t66
 
6051
partition by range(colint) 
 
6052
(partition p0 values less than (extract(year from '1998-11-23')),
 
6053
partition p1 values less than maxvalue);
 
6054
select * from t11 order by col1;
 
6055
col1
 
6056
2006-02-05
 
6057
2006-02-17
 
6058
select * from t22 order by col1;
 
6059
col1
 
6060
2006-01-25
 
6061
2006-02-05
 
6062
2006-02-17
 
6063
select * from t33 order by col1;
 
6064
col1
 
6065
2006-01-25
 
6066
2006-02-05
 
6067
2006-02-17
 
6068
select * from t44 order by colint;
 
6069
colint  col1
 
6070
1       2006-02-03
 
6071
2       2006-01-17
 
6072
3       2006-01-25
 
6073
4       2006-02-05
 
6074
select * from t55 order by colint;
 
6075
colint  col1
 
6076
1       2006-02-03
 
6077
2       2006-01-17
 
6078
3       2006-01-25
 
6079
4       2006-02-05
 
6080
select * from t66 order by colint;
 
6081
colint  col1
 
6082
1       2006-02-03
 
6083
2       2006-01-17
 
6084
3       2006-01-25
 
6085
4       2006-02-05
 
6086
---------------------------
 
6087
---- some alter table begin
 
6088
---------------------------
 
6089
alter table t11
 
6090
reorganize partition p0,p1 into
 
6091
(partition s1 values less than maxvalue);
 
6092
select * from t11 order by col1;
 
6093
col1
 
6094
2006-02-05
 
6095
2006-02-17
 
6096
alter table t11
 
6097
reorganize partition s1 into
 
6098
(partition p0 values less than (15),
 
6099
partition p1 values less than maxvalue);
 
6100
select * from t11 order by col1;
 
6101
col1
 
6102
2006-02-05
 
6103
2006-02-17
 
6104
alter table t55
 
6105
partition by list(colint)
 
6106
subpartition by hash(extract(month from col1)) subpartitions 5 
 
6107
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
6108
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
6109
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
6110
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
6111
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
6112
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
6113
);
 
6114
show create table t55;
 
6115
Table   Create Table
 
6116
t55     CREATE TABLE `t55` (
 
6117
  `colint` int(11) DEFAULT NULL,
 
6118
  `col1` date DEFAULT NULL
 
6119
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (extract(month from col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
 
6120
select * from t55 order by colint;
 
6121
colint  col1
 
6122
1       2006-02-03
 
6123
2       2006-01-17
 
6124
3       2006-01-25
 
6125
4       2006-02-05
 
6126
alter table t66
 
6127
reorganize partition p0,p1 into
 
6128
(partition s1 values less than maxvalue);
 
6129
select * from t66 order by colint;
 
6130
colint  col1
 
6131
1       2006-02-03
 
6132
2       2006-01-17
 
6133
3       2006-01-25
 
6134
4       2006-02-05
 
6135
alter table t66
 
6136
reorganize partition s1 into
 
6137
(partition p0 values less than (extract(year from '1998-11-23')),
 
6138
partition p1 values less than maxvalue);
 
6139
select * from t66 order by colint;
 
6140
colint  col1
 
6141
1       2006-02-03
 
6142
2       2006-01-17
 
6143
3       2006-01-25
 
6144
4       2006-02-05
 
6145
alter table t66
 
6146
reorganize partition p0,p1 into
 
6147
(partition s1 values less than maxvalue);
 
6148
select * from t66 order by colint;
 
6149
colint  col1
 
6150
1       2006-02-03
 
6151
2       2006-01-17
 
6152
3       2006-01-25
 
6153
4       2006-02-05
 
6154
alter table t66
 
6155
reorganize partition s1 into
 
6156
(partition p0 values less than (extract(year from '1998-11-23')),
 
6157
partition p1 values less than maxvalue);
 
6158
select * from t66 order by colint;
 
6159
colint  col1
 
6160
1       2006-02-03
 
6161
2       2006-01-17
 
6162
3       2006-01-25
 
6163
4       2006-02-05
 
6164
-------------------------------------------------------------------------
 
6165
---  Delete rows and partitions of tables with extract(month from col1)
 
6166
-------------------------------------------------------------------------
 
6167
delete from t1 where col1='2006-02-17';
 
6168
delete from t2 where col1='2006-02-17';
 
6169
delete from t3 where col1='2006-02-17';
 
6170
delete from t4 where col1='2006-02-17';
 
6171
delete from t5 where col1='2006-02-17';
 
6172
delete from t6 where col1='2006-02-17';
 
6173
select * from t1 order by col1;
 
6174
col1
 
6175
2006-02-05
 
6176
select * from t2 order by col1;
 
6177
col1
 
6178
2006-01-25
 
6179
2006-02-05
 
6180
select * from t3 order by col1;
 
6181
col1
 
6182
2006-01-25
 
6183
2006-02-05
 
6184
select * from t4 order by colint;
 
6185
colint  col1
 
6186
1       2006-02-03
 
6187
2       2006-01-17
 
6188
3       2006-01-25
 
6189
4       2006-02-05
 
6190
select * from t5 order by colint;
 
6191
colint  col1
 
6192
1       2006-02-03
 
6193
2       2006-01-17
 
6194
3       2006-01-25
 
6195
4       2006-02-05
 
6196
insert into t1 values ('2006-02-17');
 
6197
insert into t2 values ('2006-02-17');
 
6198
insert into t3 values ('2006-02-17');
 
6199
insert into t4 values (60,'2006-02-17');
 
6200
insert into t5 values (60,'2006-02-17');
 
6201
insert into t6 values (60,'2006-02-17');
 
6202
select * from t1 order by col1;
 
6203
col1
 
6204
2006-02-05
 
6205
2006-02-17
 
6206
select * from t2 order by col1;
 
6207
col1
 
6208
2006-01-25
 
6209
2006-02-05
 
6210
2006-02-17
 
6211
select * from t3 order by col1;
 
6212
col1
 
6213
2006-01-25
 
6214
2006-02-05
 
6215
2006-02-17
 
6216
select * from t4 order by colint;
 
6217
colint  col1
 
6218
1       2006-02-03
 
6219
2       2006-01-17
 
6220
3       2006-01-25
 
6221
4       2006-02-05
 
6222
60      2006-02-17
 
6223
select * from t5 order by colint;
 
6224
colint  col1
 
6225
1       2006-02-03
 
6226
2       2006-01-17
 
6227
3       2006-01-25
 
6228
4       2006-02-05
 
6229
60      2006-02-17
 
6230
select * from t6 order by colint;
 
6231
colint  col1
 
6232
1       2006-02-03
 
6233
2       2006-01-17
 
6234
3       2006-01-25
 
6235
4       2006-02-05
 
6236
60      2006-02-17
 
6237
alter table t1 drop partition p0;
 
6238
alter table t2 drop partition p0;
 
6239
alter table t4 drop partition p0;
 
6240
alter table t5 drop partition p0;
 
6241
alter table t6 drop partition p0;
 
6242
select * from t1 order by col1;
 
6243
col1
 
6244
select * from t2 order by col1;
 
6245
col1
 
6246
select * from t3 order by col1;
 
6247
col1
 
6248
2006-01-25
 
6249
2006-02-05
 
6250
2006-02-17
 
6251
select * from t4 order by colint;
 
6252
colint  col1
 
6253
60      2006-02-17
 
6254
select * from t5 order by colint;
 
6255
colint  col1
 
6256
60      2006-02-17
 
6257
select * from t6 order by colint;
 
6258
colint  col1
 
6259
-------------------------------------------------------------------------
 
6260
---  Delete rows and partitions of tables with extract(month from col1)
 
6261
-------------------------------------------------------------------------
 
6262
delete from t11 where col1='2006-02-17';
 
6263
delete from t22 where col1='2006-02-17';
 
6264
delete from t33 where col1='2006-02-17';
 
6265
delete from t44 where col1='2006-02-17';
 
6266
delete from t55 where col1='2006-02-17';
 
6267
delete from t66 where col1='2006-02-17';
 
6268
select * from t11 order by col1;
 
6269
col1
 
6270
2006-02-05
 
6271
select * from t22 order by col1;
 
6272
col1
 
6273
2006-01-25
 
6274
2006-02-05
 
6275
select * from t33 order by col1;
 
6276
col1
 
6277
2006-01-25
 
6278
2006-02-05
 
6279
select * from t44 order by colint;
 
6280
colint  col1
 
6281
1       2006-02-03
 
6282
2       2006-01-17
 
6283
3       2006-01-25
 
6284
4       2006-02-05
 
6285
select * from t55 order by colint;
 
6286
colint  col1
 
6287
1       2006-02-03
 
6288
2       2006-01-17
 
6289
3       2006-01-25
 
6290
4       2006-02-05
 
6291
insert into t11 values ('2006-02-17');
 
6292
insert into t22 values ('2006-02-17');
 
6293
insert into t33 values ('2006-02-17');
 
6294
insert into t44 values (60,'2006-02-17');
 
6295
insert into t55 values (60,'2006-02-17');
 
6296
insert into t66 values (60,'2006-02-17');
 
6297
select * from t11 order by col1;
 
6298
col1
 
6299
2006-02-05
 
6300
2006-02-17
 
6301
select * from t22 order by col1;
 
6302
col1
 
6303
2006-01-25
 
6304
2006-02-05
 
6305
2006-02-17
 
6306
select * from t33 order by col1;
 
6307
col1
 
6308
2006-01-25
 
6309
2006-02-05
 
6310
2006-02-17
 
6311
select * from t44 order by colint;
 
6312
colint  col1
 
6313
1       2006-02-03
 
6314
2       2006-01-17
 
6315
3       2006-01-25
 
6316
4       2006-02-05
 
6317
60      2006-02-17
 
6318
select * from t55 order by colint;
 
6319
colint  col1
 
6320
1       2006-02-03
 
6321
2       2006-01-17
 
6322
3       2006-01-25
 
6323
4       2006-02-05
 
6324
60      2006-02-17
 
6325
select * from t66 order by colint;
 
6326
colint  col1
 
6327
1       2006-02-03
 
6328
2       2006-01-17
 
6329
3       2006-01-25
 
6330
4       2006-02-05
 
6331
60      2006-02-17
 
6332
alter table t11 drop partition p0;
 
6333
alter table t22 drop partition p0;
 
6334
alter table t44 drop partition p0;
 
6335
alter table t55 drop partition p0;
 
6336
alter table t66 drop partition p0;
 
6337
select * from t11 order by col1;
 
6338
col1
 
6339
select * from t22 order by col1;
 
6340
col1
 
6341
select * from t33 order by col1;
 
6342
col1
 
6343
2006-01-25
 
6344
2006-02-05
 
6345
2006-02-17
 
6346
select * from t44 order by colint;
 
6347
colint  col1
 
6348
60      2006-02-17
 
6349
select * from t55 order by colint;
 
6350
colint  col1
 
6351
60      2006-02-17
 
6352
select * from t66 order by colint;
 
6353
colint  col1
 
6354
-------------------------
 
6355
---- some alter table end
 
6356
-------------------------
 
6357
drop table if exists t1 ;
 
6358
drop table if exists t2 ;
 
6359
drop table if exists t3 ;
 
6360
drop table if exists t4 ;
 
6361
drop table if exists t5 ;
 
6362
drop table if exists t6 ;
 
6363
drop table if exists t11 ;
 
6364
drop table if exists t22 ;
 
6365
drop table if exists t33 ;
 
6366
drop table if exists t44 ;
 
6367
drop table if exists t55 ;
 
6368
drop table if exists t66 ;
 
6369
-------------------------------------------------------------------------
 
6370
---  hour(col1)  in partition with coltype  time
 
6371
-------------------------------------------------------------------------
 
6372
drop table if exists t1 ;
 
6373
drop table if exists t2 ;
 
6374
drop table if exists t3 ;
 
6375
drop table if exists t4 ;
 
6376
drop table if exists t5 ;
 
6377
drop table if exists t6 ;
 
6378
-------------------------------------------------------------------------
 
6379
---  Create tables with hour(col1)
 
6380
-------------------------------------------------------------------------
 
6381
create table t1 (col1 time) engine='MYISAM' 
 
6382
partition by range(hour(col1)) 
 
6383
(partition p0 values less than (15),
 
6384
partition p1 values less than maxvalue);
 
6385
create table t2 (col1 time) engine='MYISAM' 
 
6386
partition by list(hour(col1)) 
 
6387
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
6388
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
6389
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
6390
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
6391
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
6392
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
6393
);
 
6394
create table t3 (col1 time) engine='MYISAM' 
 
6395
partition by hash(hour(col1));
 
6396
create table t4 (colint int, col1 time) engine='MYISAM' 
 
6397
partition by range(colint) 
 
6398
subpartition by hash(hour(col1)) subpartitions 2 
 
6399
(partition p0 values less than (15),
 
6400
partition p1 values less than maxvalue);
 
6401
create table t5 (colint int, col1 time) engine='MYISAM' 
 
6402
partition by list(colint)
 
6403
subpartition by hash(hour(col1)) subpartitions 2 
 
6404
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
6405
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
6406
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
6407
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
6408
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
6409
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
6410
);
 
6411
create table t6 (colint int, col1 time) engine='MYISAM' 
 
6412
partition by range(colint) 
 
6413
(partition p0 values less than (hour('18:30')),
 
6414
partition p1 values less than maxvalue);
 
6415
-------------------------------------------------------------------------
 
6416
---  Access tables with hour(col1) 
 
6417
-------------------------------------------------------------------------
 
6418
insert into t1 values ('09:09');
 
6419
insert into t1 values ('14:30');
 
6420
insert into t2 values ('09:09');
 
6421
insert into t2 values ('14:30');
 
6422
insert into t2 values ('21:59');
 
6423
insert into t3 values ('09:09');
 
6424
insert into t3 values ('14:30');
 
6425
insert into t3 values ('21:59');
 
6426
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4;
 
6427
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5;
 
6428
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6;
 
6429
select hour(col1) from t1 order by col1;
 
6430
hour(col1)
 
6431
9
 
6432
14
 
6433
select * from t1 order by col1;
 
6434
col1
 
6435
09:09:00
 
6436
14:30:00
 
6437
select * from t2 order by col1;
 
6438
col1
 
6439
09:09:00
 
6440
14:30:00
 
6441
21:59:00
 
6442
select * from t3 order by col1;
 
6443
col1
 
6444
09:09:00
 
6445
14:30:00
 
6446
21:59:00
 
6447
select * from t4 order by colint;
 
6448
colint  col1
 
6449
1       09:09:15
 
6450
2       04:30:01
 
6451
3       00:59:22
 
6452
4       05:30:34
 
6453
select * from t5 order by colint;
 
6454
colint  col1
 
6455
1       09:09:15
 
6456
2       04:30:01
 
6457
3       00:59:22
 
6458
4       05:30:34
 
6459
select * from t6 order by colint;
 
6460
colint  col1
 
6461
1       09:09:15
 
6462
2       04:30:01
 
6463
3       00:59:22
 
6464
4       05:30:34
 
6465
update t1 set col1='10:30' where col1='09:09';
 
6466
update t2 set col1='10:30' where col1='09:09';
 
6467
update t3 set col1='10:30' where col1='09:09';
 
6468
update t4 set col1='10:30' where col1='09:09';
 
6469
update t5 set col1='10:30' where col1='09:09';
 
6470
update t6 set col1='10:30' where col1='09:09';
 
6471
select * from t1 order by col1;
 
6472
col1
 
6473
10:30:00
 
6474
14:30:00
 
6475
select * from t2 order by col1;
 
6476
col1
 
6477
10:30:00
 
6478
14:30:00
 
6479
21:59:00
 
6480
select * from t3 order by col1;
 
6481
col1
 
6482
10:30:00
 
6483
14:30:00
 
6484
21:59:00
 
6485
select * from t4 order by colint;
 
6486
colint  col1
 
6487
1       09:09:15
 
6488
2       04:30:01
 
6489
3       00:59:22
 
6490
4       05:30:34
 
6491
select * from t5 order by colint;
 
6492
colint  col1
 
6493
1       09:09:15
 
6494
2       04:30:01
 
6495
3       00:59:22
 
6496
4       05:30:34
 
6497
select * from t6 order by colint;
 
6498
colint  col1
 
6499
1       09:09:15
 
6500
2       04:30:01
 
6501
3       00:59:22
 
6502
4       05:30:34
 
6503
-------------------------------------------------------------------------
 
6504
---  Alter tables with hour(col1)
 
6505
-------------------------------------------------------------------------
 
6506
drop table if exists t11 ;
 
6507
drop table if exists t22 ;
 
6508
drop table if exists t33 ;
 
6509
drop table if exists t44 ;
 
6510
drop table if exists t55 ;
 
6511
drop table if exists t66 ;
 
6512
create table t11 engine='MYISAM' as select * from t1;
 
6513
create table t22 engine='MYISAM' as select * from t2;
 
6514
create table t33 engine='MYISAM' as select * from t3;
 
6515
create table t44 engine='MYISAM' as select * from t4;
 
6516
create table t55 engine='MYISAM' as select * from t5;
 
6517
create table t66 engine='MYISAM' as select * from t6;
 
6518
alter table t11
 
6519
partition by range(hour(col1)) 
 
6520
(partition p0 values less than (15),
 
6521
partition p1 values less than maxvalue);
 
6522
alter table t22
 
6523
partition by list(hour(col1)) 
 
6524
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
6525
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
6526
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
6527
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
6528
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
6529
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
6530
);
 
6531
alter table t33
 
6532
partition by hash(hour(col1));
 
6533
alter table t44
 
6534
partition by range(colint) 
 
6535
subpartition by hash(hour(col1)) subpartitions 2 
 
6536
(partition p0 values less than (15),
 
6537
partition p1 values less than maxvalue);
 
6538
alter table t55
 
6539
partition by list(colint)
 
6540
subpartition by hash(hour(col1)) subpartitions 2 
 
6541
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
6542
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
6543
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
6544
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
6545
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
6546
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
6547
);
 
6548
alter table t66
 
6549
partition by range(colint) 
 
6550
(partition p0 values less than (hour('18:30')),
 
6551
partition p1 values less than maxvalue);
 
6552
select * from t11 order by col1;
 
6553
col1
 
6554
10:30:00
 
6555
14:30:00
 
6556
select * from t22 order by col1;
 
6557
col1
 
6558
10:30:00
 
6559
14:30:00
 
6560
21:59:00
 
6561
select * from t33 order by col1;
 
6562
col1
 
6563
10:30:00
 
6564
14:30:00
 
6565
21:59:00
 
6566
select * from t44 order by colint;
 
6567
colint  col1
 
6568
1       09:09:15
 
6569
2       04:30:01
 
6570
3       00:59:22
 
6571
4       05:30:34
 
6572
select * from t55 order by colint;
 
6573
colint  col1
 
6574
1       09:09:15
 
6575
2       04:30:01
 
6576
3       00:59:22
 
6577
4       05:30:34
 
6578
select * from t66 order by colint;
 
6579
colint  col1
 
6580
1       09:09:15
 
6581
2       04:30:01
 
6582
3       00:59:22
 
6583
4       05:30:34
 
6584
---------------------------
 
6585
---- some alter table begin
 
6586
---------------------------
 
6587
alter table t11
 
6588
reorganize partition p0,p1 into
 
6589
(partition s1 values less than maxvalue);
 
6590
select * from t11 order by col1;
 
6591
col1
 
6592
10:30:00
 
6593
14:30:00
 
6594
alter table t11
 
6595
reorganize partition s1 into
 
6596
(partition p0 values less than (15),
 
6597
partition p1 values less than maxvalue);
 
6598
select * from t11 order by col1;
 
6599
col1
 
6600
10:30:00
 
6601
14:30:00
 
6602
alter table t55
 
6603
partition by list(colint)
 
6604
subpartition by hash(hour(col1)) subpartitions 5 
 
6605
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
6606
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
6607
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
6608
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
6609
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
6610
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
6611
);
 
6612
show create table t55;
 
6613
Table   Create Table
 
6614
t55     CREATE TABLE `t55` (
 
6615
  `colint` int(11) DEFAULT NULL,
 
6616
  `col1` time DEFAULT NULL
 
6617
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (hour(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
 
6618
select * from t55 order by colint;
 
6619
colint  col1
 
6620
1       09:09:15
 
6621
2       04:30:01
 
6622
3       00:59:22
 
6623
4       05:30:34
 
6624
alter table t66
 
6625
reorganize partition p0,p1 into
 
6626
(partition s1 values less than maxvalue);
 
6627
select * from t66 order by colint;
 
6628
colint  col1
 
6629
1       09:09:15
 
6630
2       04:30:01
 
6631
3       00:59:22
 
6632
4       05:30:34
 
6633
alter table t66
 
6634
reorganize partition s1 into
 
6635
(partition p0 values less than (hour('18:30')),
 
6636
partition p1 values less than maxvalue);
 
6637
select * from t66 order by colint;
 
6638
colint  col1
 
6639
1       09:09:15
 
6640
2       04:30:01
 
6641
3       00:59:22
 
6642
4       05:30:34
 
6643
alter table t66
 
6644
reorganize partition p0,p1 into
 
6645
(partition s1 values less than maxvalue);
 
6646
select * from t66 order by colint;
 
6647
colint  col1
 
6648
1       09:09:15
 
6649
2       04:30:01
 
6650
3       00:59:22
 
6651
4       05:30:34
 
6652
alter table t66
 
6653
reorganize partition s1 into
 
6654
(partition p0 values less than (hour('18:30')),
 
6655
partition p1 values less than maxvalue);
 
6656
select * from t66 order by colint;
 
6657
colint  col1
 
6658
1       09:09:15
 
6659
2       04:30:01
 
6660
3       00:59:22
 
6661
4       05:30:34
 
6662
-------------------------------------------------------------------------
 
6663
---  Delete rows and partitions of tables with hour(col1)
 
6664
-------------------------------------------------------------------------
 
6665
delete from t1 where col1='14:30';
 
6666
delete from t2 where col1='14:30';
 
6667
delete from t3 where col1='14:30';
 
6668
delete from t4 where col1='14:30';
 
6669
delete from t5 where col1='14:30';
 
6670
delete from t6 where col1='14:30';
 
6671
select * from t1 order by col1;
 
6672
col1
 
6673
10:30:00
 
6674
select * from t2 order by col1;
 
6675
col1
 
6676
10:30:00
 
6677
21:59:00
 
6678
select * from t3 order by col1;
 
6679
col1
 
6680
10:30:00
 
6681
21:59:00
 
6682
select * from t4 order by colint;
 
6683
colint  col1
 
6684
1       09:09:15
 
6685
2       04:30:01
 
6686
3       00:59:22
 
6687
4       05:30:34
 
6688
select * from t5 order by colint;
 
6689
colint  col1
 
6690
1       09:09:15
 
6691
2       04:30:01
 
6692
3       00:59:22
 
6693
4       05:30:34
 
6694
insert into t1 values ('14:30');
 
6695
insert into t2 values ('14:30');
 
6696
insert into t3 values ('14:30');
 
6697
insert into t4 values (60,'14:30');
 
6698
insert into t5 values (60,'14:30');
 
6699
insert into t6 values (60,'14:30');
 
6700
select * from t1 order by col1;
 
6701
col1
 
6702
10:30:00
 
6703
14:30:00
 
6704
select * from t2 order by col1;
 
6705
col1
 
6706
10:30:00
 
6707
14:30:00
 
6708
21:59:00
 
6709
select * from t3 order by col1;
 
6710
col1
 
6711
10:30:00
 
6712
14:30:00
 
6713
21:59:00
 
6714
select * from t4 order by colint;
 
6715
colint  col1
 
6716
1       09:09:15
 
6717
2       04:30:01
 
6718
3       00:59:22
 
6719
4       05:30:34
 
6720
60      14:30:00
 
6721
select * from t5 order by colint;
 
6722
colint  col1
 
6723
1       09:09:15
 
6724
2       04:30:01
 
6725
3       00:59:22
 
6726
4       05:30:34
 
6727
60      14:30:00
 
6728
select * from t6 order by colint;
 
6729
colint  col1
 
6730
1       09:09:15
 
6731
2       04:30:01
 
6732
3       00:59:22
 
6733
4       05:30:34
 
6734
60      14:30:00
 
6735
alter table t1 drop partition p0;
 
6736
alter table t2 drop partition p0;
 
6737
alter table t4 drop partition p0;
 
6738
alter table t5 drop partition p0;
 
6739
alter table t6 drop partition p0;
 
6740
select * from t1 order by col1;
 
6741
col1
 
6742
select * from t2 order by col1;
 
6743
col1
 
6744
14:30:00
 
6745
21:59:00
 
6746
select * from t3 order by col1;
 
6747
col1
 
6748
10:30:00
 
6749
14:30:00
 
6750
21:59:00
 
6751
select * from t4 order by colint;
 
6752
colint  col1
 
6753
60      14:30:00
 
6754
select * from t5 order by colint;
 
6755
colint  col1
 
6756
60      14:30:00
 
6757
select * from t6 order by colint;
 
6758
colint  col1
 
6759
60      14:30:00
 
6760
-------------------------------------------------------------------------
 
6761
---  Delete rows and partitions of tables with hour(col1)
 
6762
-------------------------------------------------------------------------
 
6763
delete from t11 where col1='14:30';
 
6764
delete from t22 where col1='14:30';
 
6765
delete from t33 where col1='14:30';
 
6766
delete from t44 where col1='14:30';
 
6767
delete from t55 where col1='14:30';
 
6768
delete from t66 where col1='14:30';
 
6769
select * from t11 order by col1;
 
6770
col1
 
6771
10:30:00
 
6772
select * from t22 order by col1;
 
6773
col1
 
6774
10:30:00
 
6775
21:59:00
 
6776
select * from t33 order by col1;
 
6777
col1
 
6778
10:30:00
 
6779
21:59:00
 
6780
select * from t44 order by colint;
 
6781
colint  col1
 
6782
1       09:09:15
 
6783
2       04:30:01
 
6784
3       00:59:22
 
6785
4       05:30:34
 
6786
select * from t55 order by colint;
 
6787
colint  col1
 
6788
1       09:09:15
 
6789
2       04:30:01
 
6790
3       00:59:22
 
6791
4       05:30:34
 
6792
insert into t11 values ('14:30');
 
6793
insert into t22 values ('14:30');
 
6794
insert into t33 values ('14:30');
 
6795
insert into t44 values (60,'14:30');
 
6796
insert into t55 values (60,'14:30');
 
6797
insert into t66 values (60,'14:30');
 
6798
select * from t11 order by col1;
 
6799
col1
 
6800
10:30:00
 
6801
14:30:00
 
6802
select * from t22 order by col1;
 
6803
col1
 
6804
10:30:00
 
6805
14:30:00
 
6806
21:59:00
 
6807
select * from t33 order by col1;
 
6808
col1
 
6809
10:30:00
 
6810
14:30:00
 
6811
21:59:00
 
6812
select * from t44 order by colint;
 
6813
colint  col1
 
6814
1       09:09:15
 
6815
2       04:30:01
 
6816
3       00:59:22
 
6817
4       05:30:34
 
6818
60      14:30:00
 
6819
select * from t55 order by colint;
 
6820
colint  col1
 
6821
1       09:09:15
 
6822
2       04:30:01
 
6823
3       00:59:22
 
6824
4       05:30:34
 
6825
60      14:30:00
 
6826
select * from t66 order by colint;
 
6827
colint  col1
 
6828
1       09:09:15
 
6829
2       04:30:01
 
6830
3       00:59:22
 
6831
4       05:30:34
 
6832
60      14:30:00
 
6833
alter table t11 drop partition p0;
 
6834
alter table t22 drop partition p0;
 
6835
alter table t44 drop partition p0;
 
6836
alter table t55 drop partition p0;
 
6837
alter table t66 drop partition p0;
 
6838
select * from t11 order by col1;
 
6839
col1
 
6840
select * from t22 order by col1;
 
6841
col1
 
6842
14:30:00
 
6843
21:59:00
 
6844
select * from t33 order by col1;
 
6845
col1
 
6846
10:30:00
 
6847
14:30:00
 
6848
21:59:00
 
6849
select * from t44 order by colint;
 
6850
colint  col1
 
6851
60      14:30:00
 
6852
select * from t55 order by colint;
 
6853
colint  col1
 
6854
60      14:30:00
 
6855
select * from t66 order by colint;
 
6856
colint  col1
 
6857
60      14:30:00
 
6858
-------------------------
 
6859
---- some alter table end
 
6860
-------------------------
 
6861
drop table if exists t1 ;
 
6862
drop table if exists t2 ;
 
6863
drop table if exists t3 ;
 
6864
drop table if exists t4 ;
 
6865
drop table if exists t5 ;
 
6866
drop table if exists t6 ;
 
6867
drop table if exists t11 ;
 
6868
drop table if exists t22 ;
 
6869
drop table if exists t33 ;
 
6870
drop table if exists t44 ;
 
6871
drop table if exists t55 ;
 
6872
drop table if exists t66 ;
 
6873
-------------------------------------------------------------------------
 
6874
---  microsecond(col1)  in partition with coltype  time
 
6875
-------------------------------------------------------------------------
 
6876
drop table if exists t1 ;
 
6877
drop table if exists t2 ;
 
6878
drop table if exists t3 ;
 
6879
drop table if exists t4 ;
 
6880
drop table if exists t5 ;
 
6881
drop table if exists t6 ;
 
6882
-------------------------------------------------------------------------
 
6883
---  Create tables with microsecond(col1)
 
6884
-------------------------------------------------------------------------
 
6885
create table t1 (col1 time) engine='MYISAM' 
 
6886
partition by range(microsecond(col1)) 
 
6887
(partition p0 values less than (15),
 
6888
partition p1 values less than maxvalue);
 
6889
create table t2 (col1 time) engine='MYISAM' 
 
6890
partition by list(microsecond(col1)) 
 
6891
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
6892
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
6893
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
6894
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
6895
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
6896
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
6897
);
 
6898
create table t3 (col1 time) engine='MYISAM' 
 
6899
partition by hash(microsecond(col1));
 
6900
create table t4 (colint int, col1 time) engine='MYISAM' 
 
6901
partition by range(colint) 
 
6902
subpartition by hash(microsecond(col1)) subpartitions 2 
 
6903
(partition p0 values less than (15),
 
6904
partition p1 values less than maxvalue);
 
6905
create table t5 (colint int, col1 time) engine='MYISAM' 
 
6906
partition by list(colint)
 
6907
subpartition by hash(microsecond(col1)) subpartitions 2 
 
6908
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
6909
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
6910
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
6911
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
6912
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
6913
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
6914
);
 
6915
create table t6 (colint int, col1 time) engine='MYISAM' 
 
6916
partition by range(colint) 
 
6917
(partition p0 values less than (microsecond('10:30:10.000010')),
 
6918
partition p1 values less than maxvalue);
 
6919
-------------------------------------------------------------------------
 
6920
---  Access tables with microsecond(col1) 
 
6921
-------------------------------------------------------------------------
 
6922
insert into t1 values ('09:09:15.000002');
 
6923
insert into t1 values ('04:30:01.000018');
 
6924
insert into t2 values ('09:09:15.000002');
 
6925
insert into t2 values ('04:30:01.000018');
 
6926
insert into t2 values ('00:59:22.000024');
 
6927
insert into t3 values ('09:09:15.000002');
 
6928
insert into t3 values ('04:30:01.000018');
 
6929
insert into t3 values ('00:59:22.000024');
 
6930
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4;
 
6931
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5;
 
6932
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6;
 
6933
select microsecond(col1) from t1 order by col1;
 
6934
microsecond(col1)
 
6935
0
 
6936
0
 
6937
select * from t1 order by col1;
 
6938
col1
 
6939
04:30:01
 
6940
09:09:15
 
6941
select * from t2 order by col1;
 
6942
col1
 
6943
00:59:22
 
6944
04:30:01
 
6945
09:09:15
 
6946
select * from t3 order by col1;
 
6947
col1
 
6948
00:59:22
 
6949
04:30:01
 
6950
09:09:15
 
6951
select * from t4 order by colint;
 
6952
colint  col1
 
6953
1       09:09:15
 
6954
2       04:30:01
 
6955
3       00:59:22
 
6956
4       05:30:34
 
6957
select * from t5 order by colint;
 
6958
colint  col1
 
6959
1       09:09:15
 
6960
2       04:30:01
 
6961
3       00:59:22
 
6962
4       05:30:34
 
6963
select * from t6 order by colint;
 
6964
colint  col1
 
6965
1       09:09:15
 
6966
2       04:30:01
 
6967
3       00:59:22
 
6968
4       05:30:34
 
6969
update t1 set col1='05:30:34.000037' where col1='09:09:15.000002';
 
6970
update t2 set col1='05:30:34.000037' where col1='09:09:15.000002';
 
6971
update t3 set col1='05:30:34.000037' where col1='09:09:15.000002';
 
6972
update t4 set col1='05:30:34.000037' where col1='09:09:15.000002';
 
6973
update t5 set col1='05:30:34.000037' where col1='09:09:15.000002';
 
6974
update t6 set col1='05:30:34.000037' where col1='09:09:15.000002';
 
6975
select * from t1 order by col1;
 
6976
col1
 
6977
04:30:01
 
6978
05:30:34
 
6979
select * from t2 order by col1;
 
6980
col1
 
6981
00:59:22
 
6982
04:30:01
 
6983
05:30:34
 
6984
select * from t3 order by col1;
 
6985
col1
 
6986
00:59:22
 
6987
04:30:01
 
6988
05:30:34
 
6989
select * from t4 order by colint;
 
6990
colint  col1
 
6991
1       05:30:34
 
6992
2       04:30:01
 
6993
3       00:59:22
 
6994
4       05:30:34
 
6995
select * from t5 order by colint;
 
6996
colint  col1
 
6997
1       05:30:34
 
6998
2       04:30:01
 
6999
3       00:59:22
 
7000
4       05:30:34
 
7001
select * from t6 order by colint;
 
7002
colint  col1
 
7003
1       05:30:34
 
7004
2       04:30:01
 
7005
3       00:59:22
 
7006
4       05:30:34
 
7007
-------------------------------------------------------------------------
 
7008
---  Alter tables with microsecond(col1)
 
7009
-------------------------------------------------------------------------
 
7010
drop table if exists t11 ;
 
7011
drop table if exists t22 ;
 
7012
drop table if exists t33 ;
 
7013
drop table if exists t44 ;
 
7014
drop table if exists t55 ;
 
7015
drop table if exists t66 ;
 
7016
create table t11 engine='MYISAM' as select * from t1;
 
7017
create table t22 engine='MYISAM' as select * from t2;
 
7018
create table t33 engine='MYISAM' as select * from t3;
 
7019
create table t44 engine='MYISAM' as select * from t4;
 
7020
create table t55 engine='MYISAM' as select * from t5;
 
7021
create table t66 engine='MYISAM' as select * from t6;
 
7022
alter table t11
 
7023
partition by range(microsecond(col1)) 
 
7024
(partition p0 values less than (15),
 
7025
partition p1 values less than maxvalue);
 
7026
alter table t22
 
7027
partition by list(microsecond(col1)) 
 
7028
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
7029
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
7030
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
7031
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
7032
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
7033
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
7034
);
 
7035
alter table t33
 
7036
partition by hash(microsecond(col1));
 
7037
alter table t44
 
7038
partition by range(colint) 
 
7039
subpartition by hash(microsecond(col1)) subpartitions 2 
 
7040
(partition p0 values less than (15),
 
7041
partition p1 values less than maxvalue);
 
7042
alter table t55
 
7043
partition by list(colint)
 
7044
subpartition by hash(microsecond(col1)) subpartitions 2 
 
7045
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
7046
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
7047
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
7048
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
7049
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
7050
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
7051
);
 
7052
alter table t66
 
7053
partition by range(colint) 
 
7054
(partition p0 values less than (microsecond('10:30:10.000010')),
 
7055
partition p1 values less than maxvalue);
 
7056
select * from t11 order by col1;
 
7057
col1
 
7058
04:30:01
 
7059
05:30:34
 
7060
select * from t22 order by col1;
 
7061
col1
 
7062
00:59:22
 
7063
04:30:01
 
7064
05:30:34
 
7065
select * from t33 order by col1;
 
7066
col1
 
7067
00:59:22
 
7068
04:30:01
 
7069
05:30:34
 
7070
select * from t44 order by colint;
 
7071
colint  col1
 
7072
1       05:30:34
 
7073
2       04:30:01
 
7074
3       00:59:22
 
7075
4       05:30:34
 
7076
select * from t55 order by colint;
 
7077
colint  col1
 
7078
1       05:30:34
 
7079
2       04:30:01
 
7080
3       00:59:22
 
7081
4       05:30:34
 
7082
select * from t66 order by colint;
 
7083
colint  col1
 
7084
1       05:30:34
 
7085
2       04:30:01
 
7086
3       00:59:22
 
7087
4       05:30:34
 
7088
---------------------------
 
7089
---- some alter table begin
 
7090
---------------------------
 
7091
alter table t11
 
7092
reorganize partition p0,p1 into
 
7093
(partition s1 values less than maxvalue);
 
7094
select * from t11 order by col1;
 
7095
col1
 
7096
04:30:01
 
7097
05:30:34
 
7098
alter table t11
 
7099
reorganize partition s1 into
 
7100
(partition p0 values less than (15),
 
7101
partition p1 values less than maxvalue);
 
7102
select * from t11 order by col1;
 
7103
col1
 
7104
04:30:01
 
7105
05:30:34
 
7106
alter table t55
 
7107
partition by list(colint)
 
7108
subpartition by hash(microsecond(col1)) subpartitions 5 
 
7109
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
7110
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
7111
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
7112
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
7113
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
7114
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
7115
);
 
7116
show create table t55;
 
7117
Table   Create Table
 
7118
t55     CREATE TABLE `t55` (
 
7119
  `colint` int(11) DEFAULT NULL,
 
7120
  `col1` time DEFAULT NULL
 
7121
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (microsecond(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
 
7122
select * from t55 order by colint;
 
7123
colint  col1
 
7124
1       05:30:34
 
7125
2       04:30:01
 
7126
3       00:59:22
 
7127
4       05:30:34
 
7128
alter table t66
 
7129
reorganize partition p0,p1 into
 
7130
(partition s1 values less than maxvalue);
 
7131
select * from t66 order by colint;
 
7132
colint  col1
 
7133
1       05:30:34
 
7134
2       04:30:01
 
7135
3       00:59:22
 
7136
4       05:30:34
 
7137
alter table t66
 
7138
reorganize partition s1 into
 
7139
(partition p0 values less than (microsecond('10:30:10.000010')),
 
7140
partition p1 values less than maxvalue);
 
7141
select * from t66 order by colint;
 
7142
colint  col1
 
7143
1       05:30:34
 
7144
2       04:30:01
 
7145
3       00:59:22
 
7146
4       05:30:34
 
7147
alter table t66
 
7148
reorganize partition p0,p1 into
 
7149
(partition s1 values less than maxvalue);
 
7150
select * from t66 order by colint;
 
7151
colint  col1
 
7152
1       05:30:34
 
7153
2       04:30:01
 
7154
3       00:59:22
 
7155
4       05:30:34
 
7156
alter table t66
 
7157
reorganize partition s1 into
 
7158
(partition p0 values less than (microsecond('10:30:10.000010')),
 
7159
partition p1 values less than maxvalue);
 
7160
select * from t66 order by colint;
 
7161
colint  col1
 
7162
1       05:30:34
 
7163
2       04:30:01
 
7164
3       00:59:22
 
7165
4       05:30:34
 
7166
-------------------------------------------------------------------------
 
7167
---  Delete rows and partitions of tables with microsecond(col1)
 
7168
-------------------------------------------------------------------------
 
7169
delete from t1 where col1='04:30:01.000018';
 
7170
delete from t2 where col1='04:30:01.000018';
 
7171
delete from t3 where col1='04:30:01.000018';
 
7172
delete from t4 where col1='04:30:01.000018';
 
7173
delete from t5 where col1='04:30:01.000018';
 
7174
delete from t6 where col1='04:30:01.000018';
 
7175
select * from t1 order by col1;
 
7176
col1
 
7177
05:30:34
 
7178
select * from t2 order by col1;
 
7179
col1
 
7180
00:59:22
 
7181
05:30:34
 
7182
select * from t3 order by col1;
 
7183
col1
 
7184
00:59:22
 
7185
05:30:34
 
7186
select * from t4 order by colint;
 
7187
colint  col1
 
7188
1       05:30:34
 
7189
3       00:59:22
 
7190
4       05:30:34
 
7191
select * from t5 order by colint;
 
7192
colint  col1
 
7193
1       05:30:34
 
7194
3       00:59:22
 
7195
4       05:30:34
 
7196
insert into t1 values ('04:30:01.000018');
 
7197
insert into t2 values ('04:30:01.000018');
 
7198
insert into t3 values ('04:30:01.000018');
 
7199
insert into t4 values (60,'04:30:01.000018');
 
7200
insert into t5 values (60,'04:30:01.000018');
 
7201
insert into t6 values (60,'04:30:01.000018');
 
7202
select * from t1 order by col1;
 
7203
col1
 
7204
04:30:01
 
7205
05:30:34
 
7206
select * from t2 order by col1;
 
7207
col1
 
7208
00:59:22
 
7209
04:30:01
 
7210
05:30:34
 
7211
select * from t3 order by col1;
 
7212
col1
 
7213
00:59:22
 
7214
04:30:01
 
7215
05:30:34
 
7216
select * from t4 order by colint;
 
7217
colint  col1
 
7218
1       05:30:34
 
7219
3       00:59:22
 
7220
4       05:30:34
 
7221
60      04:30:01
 
7222
select * from t5 order by colint;
 
7223
colint  col1
 
7224
1       05:30:34
 
7225
3       00:59:22
 
7226
4       05:30:34
 
7227
60      04:30:01
 
7228
select * from t6 order by colint;
 
7229
colint  col1
 
7230
1       05:30:34
 
7231
3       00:59:22
 
7232
4       05:30:34
 
7233
60      04:30:01
 
7234
alter table t1 drop partition p0;
 
7235
alter table t2 drop partition p0;
 
7236
alter table t4 drop partition p0;
 
7237
alter table t5 drop partition p0;
 
7238
alter table t6 drop partition p0;
 
7239
select * from t1 order by col1;
 
7240
col1
 
7241
select * from t2 order by col1;
 
7242
col1
 
7243
select * from t3 order by col1;
 
7244
col1
 
7245
00:59:22
 
7246
04:30:01
 
7247
05:30:34
 
7248
select * from t4 order by colint;
 
7249
colint  col1
 
7250
60      04:30:01
 
7251
select * from t5 order by colint;
 
7252
colint  col1
 
7253
60      04:30:01
 
7254
select * from t6 order by colint;
 
7255
colint  col1
 
7256
60      04:30:01
 
7257
-------------------------------------------------------------------------
 
7258
---  Delete rows and partitions of tables with microsecond(col1)
 
7259
-------------------------------------------------------------------------
 
7260
delete from t11 where col1='04:30:01.000018';
 
7261
delete from t22 where col1='04:30:01.000018';
 
7262
delete from t33 where col1='04:30:01.000018';
 
7263
delete from t44 where col1='04:30:01.000018';
 
7264
delete from t55 where col1='04:30:01.000018';
 
7265
delete from t66 where col1='04:30:01.000018';
 
7266
select * from t11 order by col1;
 
7267
col1
 
7268
05:30:34
 
7269
select * from t22 order by col1;
 
7270
col1
 
7271
00:59:22
 
7272
05:30:34
 
7273
select * from t33 order by col1;
 
7274
col1
 
7275
00:59:22
 
7276
05:30:34
 
7277
select * from t44 order by colint;
 
7278
colint  col1
 
7279
1       05:30:34
 
7280
3       00:59:22
 
7281
4       05:30:34
 
7282
select * from t55 order by colint;
 
7283
colint  col1
 
7284
1       05:30:34
 
7285
3       00:59:22
 
7286
4       05:30:34
 
7287
insert into t11 values ('04:30:01.000018');
 
7288
insert into t22 values ('04:30:01.000018');
 
7289
insert into t33 values ('04:30:01.000018');
 
7290
insert into t44 values (60,'04:30:01.000018');
 
7291
insert into t55 values (60,'04:30:01.000018');
 
7292
insert into t66 values (60,'04:30:01.000018');
 
7293
select * from t11 order by col1;
 
7294
col1
 
7295
04:30:01
 
7296
05:30:34
 
7297
select * from t22 order by col1;
 
7298
col1
 
7299
00:59:22
 
7300
04:30:01
 
7301
05:30:34
 
7302
select * from t33 order by col1;
 
7303
col1
 
7304
00:59:22
 
7305
04:30:01
 
7306
05:30:34
 
7307
select * from t44 order by colint;
 
7308
colint  col1
 
7309
1       05:30:34
 
7310
3       00:59:22
 
7311
4       05:30:34
 
7312
60      04:30:01
 
7313
select * from t55 order by colint;
 
7314
colint  col1
 
7315
1       05:30:34
 
7316
3       00:59:22
 
7317
4       05:30:34
 
7318
60      04:30:01
 
7319
select * from t66 order by colint;
 
7320
colint  col1
 
7321
1       05:30:34
 
7322
3       00:59:22
 
7323
4       05:30:34
 
7324
60      04:30:01
 
7325
alter table t11 drop partition p0;
 
7326
alter table t22 drop partition p0;
 
7327
alter table t44 drop partition p0;
 
7328
alter table t55 drop partition p0;
 
7329
alter table t66 drop partition p0;
 
7330
select * from t11 order by col1;
 
7331
col1
 
7332
select * from t22 order by col1;
 
7333
col1
 
7334
select * from t33 order by col1;
 
7335
col1
 
7336
00:59:22
 
7337
04:30:01
 
7338
05:30:34
 
7339
select * from t44 order by colint;
 
7340
colint  col1
 
7341
60      04:30:01
 
7342
select * from t55 order by colint;
 
7343
colint  col1
 
7344
60      04:30:01
 
7345
select * from t66 order by colint;
 
7346
colint  col1
 
7347
60      04:30:01
 
7348
-------------------------
 
7349
---- some alter table end
 
7350
-------------------------
 
7351
drop table if exists t1 ;
 
7352
drop table if exists t2 ;
 
7353
drop table if exists t3 ;
 
7354
drop table if exists t4 ;
 
7355
drop table if exists t5 ;
 
7356
drop table if exists t6 ;
 
7357
drop table if exists t11 ;
 
7358
drop table if exists t22 ;
 
7359
drop table if exists t33 ;
 
7360
drop table if exists t44 ;
 
7361
drop table if exists t55 ;
 
7362
drop table if exists t66 ;
 
7363
-------------------------------------------------------------------------
 
7364
---  minute(col1)  in partition with coltype  time
 
7365
-------------------------------------------------------------------------
 
7366
drop table if exists t1 ;
 
7367
drop table if exists t2 ;
 
7368
drop table if exists t3 ;
 
7369
drop table if exists t4 ;
 
7370
drop table if exists t5 ;
 
7371
drop table if exists t6 ;
 
7372
-------------------------------------------------------------------------
 
7373
---  Create tables with minute(col1)
 
7374
-------------------------------------------------------------------------
 
7375
create table t1 (col1 time) engine='MYISAM' 
 
7376
partition by range(minute(col1)) 
 
7377
(partition p0 values less than (15),
 
7378
partition p1 values less than maxvalue);
 
7379
create table t2 (col1 time) engine='MYISAM' 
 
7380
partition by list(minute(col1)) 
 
7381
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
7382
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
7383
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
7384
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
7385
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
7386
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
7387
);
 
7388
create table t3 (col1 time) engine='MYISAM' 
 
7389
partition by hash(minute(col1));
 
7390
create table t4 (colint int, col1 time) engine='MYISAM' 
 
7391
partition by range(colint) 
 
7392
subpartition by hash(minute(col1)) subpartitions 2 
 
7393
(partition p0 values less than (15),
 
7394
partition p1 values less than maxvalue);
 
7395
create table t5 (colint int, col1 time) engine='MYISAM' 
 
7396
partition by list(colint)
 
7397
subpartition by hash(minute(col1)) subpartitions 2 
 
7398
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
7399
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
7400
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
7401
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
7402
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
7403
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
7404
);
 
7405
create table t6 (colint int, col1 time) engine='MYISAM' 
 
7406
partition by range(colint) 
 
7407
(partition p0 values less than (minute('18:30')),
 
7408
partition p1 values less than maxvalue);
 
7409
-------------------------------------------------------------------------
 
7410
---  Access tables with minute(col1) 
 
7411
-------------------------------------------------------------------------
 
7412
insert into t1 values ('09:09:15');
 
7413
insert into t1 values ('14:30:45');
 
7414
insert into t2 values ('09:09:15');
 
7415
insert into t2 values ('14:30:45');
 
7416
insert into t2 values ('21:59:22');
 
7417
insert into t3 values ('09:09:15');
 
7418
insert into t3 values ('14:30:45');
 
7419
insert into t3 values ('21:59:22');
 
7420
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4;
 
7421
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5;
 
7422
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6;
 
7423
select minute(col1) from t1 order by col1;
 
7424
minute(col1)
 
7425
9
 
7426
30
 
7427
select * from t1 order by col1;
 
7428
col1
 
7429
09:09:15
 
7430
14:30:45
 
7431
select * from t2 order by col1;
 
7432
col1
 
7433
09:09:15
 
7434
14:30:45
 
7435
21:59:22
 
7436
select * from t3 order by col1;
 
7437
col1
 
7438
09:09:15
 
7439
14:30:45
 
7440
21:59:22
 
7441
select * from t4 order by colint;
 
7442
colint  col1
 
7443
1       09:09:15
 
7444
2       04:30:01
 
7445
3       00:59:22
 
7446
4       05:30:34
 
7447
select * from t5 order by colint;
 
7448
colint  col1
 
7449
1       09:09:15
 
7450
2       04:30:01
 
7451
3       00:59:22
 
7452
4       05:30:34
 
7453
select * from t6 order by colint;
 
7454
colint  col1
 
7455
1       09:09:15
 
7456
2       04:30:01
 
7457
3       00:59:22
 
7458
4       05:30:34
 
7459
update t1 set col1='10:24:23' where col1='09:09:15';
 
7460
update t2 set col1='10:24:23' where col1='09:09:15';
 
7461
update t3 set col1='10:24:23' where col1='09:09:15';
 
7462
update t4 set col1='10:24:23' where col1='09:09:15';
 
7463
update t5 set col1='10:24:23' where col1='09:09:15';
 
7464
update t6 set col1='10:24:23' where col1='09:09:15';
 
7465
select * from t1 order by col1;
 
7466
col1
 
7467
10:24:23
 
7468
14:30:45
 
7469
select * from t2 order by col1;
 
7470
col1
 
7471
10:24:23
 
7472
14:30:45
 
7473
21:59:22
 
7474
select * from t3 order by col1;
 
7475
col1
 
7476
10:24:23
 
7477
14:30:45
 
7478
21:59:22
 
7479
select * from t4 order by colint;
 
7480
colint  col1
 
7481
1       10:24:23
 
7482
2       04:30:01
 
7483
3       00:59:22
 
7484
4       05:30:34
 
7485
select * from t5 order by colint;
 
7486
colint  col1
 
7487
1       10:24:23
 
7488
2       04:30:01
 
7489
3       00:59:22
 
7490
4       05:30:34
 
7491
select * from t6 order by colint;
 
7492
colint  col1
 
7493
1       10:24:23
 
7494
2       04:30:01
 
7495
3       00:59:22
 
7496
4       05:30:34
 
7497
-------------------------------------------------------------------------
 
7498
---  Alter tables with minute(col1)
 
7499
-------------------------------------------------------------------------
 
7500
drop table if exists t11 ;
 
7501
drop table if exists t22 ;
 
7502
drop table if exists t33 ;
 
7503
drop table if exists t44 ;
 
7504
drop table if exists t55 ;
 
7505
drop table if exists t66 ;
 
7506
create table t11 engine='MYISAM' as select * from t1;
 
7507
create table t22 engine='MYISAM' as select * from t2;
 
7508
create table t33 engine='MYISAM' as select * from t3;
 
7509
create table t44 engine='MYISAM' as select * from t4;
 
7510
create table t55 engine='MYISAM' as select * from t5;
 
7511
create table t66 engine='MYISAM' as select * from t6;
 
7512
alter table t11
 
7513
partition by range(minute(col1)) 
 
7514
(partition p0 values less than (15),
 
7515
partition p1 values less than maxvalue);
 
7516
alter table t22
 
7517
partition by list(minute(col1)) 
 
7518
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
7519
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
7520
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
7521
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
7522
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
7523
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
7524
);
 
7525
alter table t33
 
7526
partition by hash(minute(col1));
 
7527
alter table t44
 
7528
partition by range(colint) 
 
7529
subpartition by hash(minute(col1)) subpartitions 2 
 
7530
(partition p0 values less than (15),
 
7531
partition p1 values less than maxvalue);
 
7532
alter table t55
 
7533
partition by list(colint)
 
7534
subpartition by hash(minute(col1)) subpartitions 2 
 
7535
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
7536
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
7537
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
7538
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
7539
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
7540
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
7541
);
 
7542
alter table t66
 
7543
partition by range(colint) 
 
7544
(partition p0 values less than (minute('18:30')),
 
7545
partition p1 values less than maxvalue);
 
7546
select * from t11 order by col1;
 
7547
col1
 
7548
10:24:23
 
7549
14:30:45
 
7550
select * from t22 order by col1;
 
7551
col1
 
7552
10:24:23
 
7553
14:30:45
 
7554
21:59:22
 
7555
select * from t33 order by col1;
 
7556
col1
 
7557
10:24:23
 
7558
14:30:45
 
7559
21:59:22
 
7560
select * from t44 order by colint;
 
7561
colint  col1
 
7562
1       10:24:23
 
7563
2       04:30:01
 
7564
3       00:59:22
 
7565
4       05:30:34
 
7566
select * from t55 order by colint;
 
7567
colint  col1
 
7568
1       10:24:23
 
7569
2       04:30:01
 
7570
3       00:59:22
 
7571
4       05:30:34
 
7572
select * from t66 order by colint;
 
7573
colint  col1
 
7574
1       10:24:23
 
7575
2       04:30:01
 
7576
3       00:59:22
 
7577
4       05:30:34
 
7578
---------------------------
 
7579
---- some alter table begin
 
7580
---------------------------
 
7581
alter table t11
 
7582
reorganize partition p0,p1 into
 
7583
(partition s1 values less than maxvalue);
 
7584
select * from t11 order by col1;
 
7585
col1
 
7586
10:24:23
 
7587
14:30:45
 
7588
alter table t11
 
7589
reorganize partition s1 into
 
7590
(partition p0 values less than (15),
 
7591
partition p1 values less than maxvalue);
 
7592
select * from t11 order by col1;
 
7593
col1
 
7594
10:24:23
 
7595
14:30:45
 
7596
alter table t55
 
7597
partition by list(colint)
 
7598
subpartition by hash(minute(col1)) subpartitions 5 
 
7599
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
7600
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
7601
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
7602
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
7603
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
7604
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
7605
);
 
7606
show create table t55;
 
7607
Table   Create Table
 
7608
t55     CREATE TABLE `t55` (
 
7609
  `colint` int(11) DEFAULT NULL,
 
7610
  `col1` time DEFAULT NULL
 
7611
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (minute(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
 
7612
select * from t55 order by colint;
 
7613
colint  col1
 
7614
1       10:24:23
 
7615
2       04:30:01
 
7616
3       00:59:22
 
7617
4       05:30:34
 
7618
alter table t66
 
7619
reorganize partition p0,p1 into
 
7620
(partition s1 values less than maxvalue);
 
7621
select * from t66 order by colint;
 
7622
colint  col1
 
7623
1       10:24:23
 
7624
2       04:30:01
 
7625
3       00:59:22
 
7626
4       05:30:34
 
7627
alter table t66
 
7628
reorganize partition s1 into
 
7629
(partition p0 values less than (minute('18:30')),
 
7630
partition p1 values less than maxvalue);
 
7631
select * from t66 order by colint;
 
7632
colint  col1
 
7633
1       10:24:23
 
7634
2       04:30:01
 
7635
3       00:59:22
 
7636
4       05:30:34
 
7637
alter table t66
 
7638
reorganize partition p0,p1 into
 
7639
(partition s1 values less than maxvalue);
 
7640
select * from t66 order by colint;
 
7641
colint  col1
 
7642
1       10:24:23
 
7643
2       04:30:01
 
7644
3       00:59:22
 
7645
4       05:30:34
 
7646
alter table t66
 
7647
reorganize partition s1 into
 
7648
(partition p0 values less than (minute('18:30')),
 
7649
partition p1 values less than maxvalue);
 
7650
select * from t66 order by colint;
 
7651
colint  col1
 
7652
1       10:24:23
 
7653
2       04:30:01
 
7654
3       00:59:22
 
7655
4       05:30:34
 
7656
-------------------------------------------------------------------------
 
7657
---  Delete rows and partitions of tables with minute(col1)
 
7658
-------------------------------------------------------------------------
 
7659
delete from t1 where col1='14:30:45';
 
7660
delete from t2 where col1='14:30:45';
 
7661
delete from t3 where col1='14:30:45';
 
7662
delete from t4 where col1='14:30:45';
 
7663
delete from t5 where col1='14:30:45';
 
7664
delete from t6 where col1='14:30:45';
 
7665
select * from t1 order by col1;
 
7666
col1
 
7667
10:24:23
 
7668
select * from t2 order by col1;
 
7669
col1
 
7670
10:24:23
 
7671
21:59:22
 
7672
select * from t3 order by col1;
 
7673
col1
 
7674
10:24:23
 
7675
21:59:22
 
7676
select * from t4 order by colint;
 
7677
colint  col1
 
7678
1       10:24:23
 
7679
2       04:30:01
 
7680
3       00:59:22
 
7681
4       05:30:34
 
7682
select * from t5 order by colint;
 
7683
colint  col1
 
7684
1       10:24:23
 
7685
2       04:30:01
 
7686
3       00:59:22
 
7687
4       05:30:34
 
7688
insert into t1 values ('14:30:45');
 
7689
insert into t2 values ('14:30:45');
 
7690
insert into t3 values ('14:30:45');
 
7691
insert into t4 values (60,'14:30:45');
 
7692
insert into t5 values (60,'14:30:45');
 
7693
insert into t6 values (60,'14:30:45');
 
7694
select * from t1 order by col1;
 
7695
col1
 
7696
10:24:23
 
7697
14:30:45
 
7698
select * from t2 order by col1;
 
7699
col1
 
7700
10:24:23
 
7701
14:30:45
 
7702
21:59:22
 
7703
select * from t3 order by col1;
 
7704
col1
 
7705
10:24:23
 
7706
14:30:45
 
7707
21:59:22
 
7708
select * from t4 order by colint;
 
7709
colint  col1
 
7710
1       10:24:23
 
7711
2       04:30:01
 
7712
3       00:59:22
 
7713
4       05:30:34
 
7714
60      14:30:45
 
7715
select * from t5 order by colint;
 
7716
colint  col1
 
7717
1       10:24:23
 
7718
2       04:30:01
 
7719
3       00:59:22
 
7720
4       05:30:34
 
7721
60      14:30:45
 
7722
select * from t6 order by colint;
 
7723
colint  col1
 
7724
1       10:24:23
 
7725
2       04:30:01
 
7726
3       00:59:22
 
7727
4       05:30:34
 
7728
60      14:30:45
 
7729
alter table t1 drop partition p0;
 
7730
alter table t2 drop partition p0;
 
7731
alter table t4 drop partition p0;
 
7732
alter table t5 drop partition p0;
 
7733
alter table t6 drop partition p0;
 
7734
select * from t1 order by col1;
 
7735
col1
 
7736
10:24:23
 
7737
14:30:45
 
7738
select * from t2 order by col1;
 
7739
col1
 
7740
10:24:23
 
7741
14:30:45
 
7742
21:59:22
 
7743
select * from t3 order by col1;
 
7744
col1
 
7745
10:24:23
 
7746
14:30:45
 
7747
21:59:22
 
7748
select * from t4 order by colint;
 
7749
colint  col1
 
7750
60      14:30:45
 
7751
select * from t5 order by colint;
 
7752
colint  col1
 
7753
60      14:30:45
 
7754
select * from t6 order by colint;
 
7755
colint  col1
 
7756
60      14:30:45
 
7757
-------------------------------------------------------------------------
 
7758
---  Delete rows and partitions of tables with minute(col1)
 
7759
-------------------------------------------------------------------------
 
7760
delete from t11 where col1='14:30:45';
 
7761
delete from t22 where col1='14:30:45';
 
7762
delete from t33 where col1='14:30:45';
 
7763
delete from t44 where col1='14:30:45';
 
7764
delete from t55 where col1='14:30:45';
 
7765
delete from t66 where col1='14:30:45';
 
7766
select * from t11 order by col1;
 
7767
col1
 
7768
10:24:23
 
7769
select * from t22 order by col1;
 
7770
col1
 
7771
10:24:23
 
7772
21:59:22
 
7773
select * from t33 order by col1;
 
7774
col1
 
7775
10:24:23
 
7776
21:59:22
 
7777
select * from t44 order by colint;
 
7778
colint  col1
 
7779
1       10:24:23
 
7780
2       04:30:01
 
7781
3       00:59:22
 
7782
4       05:30:34
 
7783
select * from t55 order by colint;
 
7784
colint  col1
 
7785
1       10:24:23
 
7786
2       04:30:01
 
7787
3       00:59:22
 
7788
4       05:30:34
 
7789
insert into t11 values ('14:30:45');
 
7790
insert into t22 values ('14:30:45');
 
7791
insert into t33 values ('14:30:45');
 
7792
insert into t44 values (60,'14:30:45');
 
7793
insert into t55 values (60,'14:30:45');
 
7794
insert into t66 values (60,'14:30:45');
 
7795
select * from t11 order by col1;
 
7796
col1
 
7797
10:24:23
 
7798
14:30:45
 
7799
select * from t22 order by col1;
 
7800
col1
 
7801
10:24:23
 
7802
14:30:45
 
7803
21:59:22
 
7804
select * from t33 order by col1;
 
7805
col1
 
7806
10:24:23
 
7807
14:30:45
 
7808
21:59:22
 
7809
select * from t44 order by colint;
 
7810
colint  col1
 
7811
1       10:24:23
 
7812
2       04:30:01
 
7813
3       00:59:22
 
7814
4       05:30:34
 
7815
60      14:30:45
 
7816
select * from t55 order by colint;
 
7817
colint  col1
 
7818
1       10:24:23
 
7819
2       04:30:01
 
7820
3       00:59:22
 
7821
4       05:30:34
 
7822
60      14:30:45
 
7823
select * from t66 order by colint;
 
7824
colint  col1
 
7825
1       10:24:23
 
7826
2       04:30:01
 
7827
3       00:59:22
 
7828
4       05:30:34
 
7829
60      14:30:45
 
7830
alter table t11 drop partition p0;
 
7831
alter table t22 drop partition p0;
 
7832
alter table t44 drop partition p0;
 
7833
alter table t55 drop partition p0;
 
7834
alter table t66 drop partition p0;
 
7835
select * from t11 order by col1;
 
7836
col1
 
7837
10:24:23
 
7838
14:30:45
 
7839
select * from t22 order by col1;
 
7840
col1
 
7841
10:24:23
 
7842
14:30:45
 
7843
21:59:22
 
7844
select * from t33 order by col1;
 
7845
col1
 
7846
10:24:23
 
7847
14:30:45
 
7848
21:59:22
 
7849
select * from t44 order by colint;
 
7850
colint  col1
 
7851
60      14:30:45
 
7852
select * from t55 order by colint;
 
7853
colint  col1
 
7854
60      14:30:45
 
7855
select * from t66 order by colint;
 
7856
colint  col1
 
7857
60      14:30:45
 
7858
-------------------------
 
7859
---- some alter table end
 
7860
-------------------------
 
7861
drop table if exists t1 ;
 
7862
drop table if exists t2 ;
 
7863
drop table if exists t3 ;
 
7864
drop table if exists t4 ;
 
7865
drop table if exists t5 ;
 
7866
drop table if exists t6 ;
 
7867
drop table if exists t11 ;
 
7868
drop table if exists t22 ;
 
7869
drop table if exists t33 ;
 
7870
drop table if exists t44 ;
 
7871
drop table if exists t55 ;
 
7872
drop table if exists t66 ;
 
7873
-------------------------------------------------------------------------
 
7874
---  second(col1)  in partition with coltype  time
 
7875
-------------------------------------------------------------------------
 
7876
drop table if exists t1 ;
 
7877
drop table if exists t2 ;
 
7878
drop table if exists t3 ;
 
7879
drop table if exists t4 ;
 
7880
drop table if exists t5 ;
 
7881
drop table if exists t6 ;
 
7882
-------------------------------------------------------------------------
 
7883
---  Create tables with second(col1)
 
7884
-------------------------------------------------------------------------
 
7885
create table t1 (col1 time) engine='MYISAM' 
 
7886
partition by range(second(col1)) 
 
7887
(partition p0 values less than (15),
 
7888
partition p1 values less than maxvalue);
 
7889
create table t2 (col1 time) engine='MYISAM' 
 
7890
partition by list(second(col1)) 
 
7891
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
7892
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
7893
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
7894
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
7895
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
7896
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
7897
);
 
7898
create table t3 (col1 time) engine='MYISAM' 
 
7899
partition by hash(second(col1));
 
7900
create table t4 (colint int, col1 time) engine='MYISAM' 
 
7901
partition by range(colint) 
 
7902
subpartition by hash(second(col1)) subpartitions 2 
 
7903
(partition p0 values less than (15),
 
7904
partition p1 values less than maxvalue);
 
7905
create table t5 (colint int, col1 time) engine='MYISAM' 
 
7906
partition by list(colint)
 
7907
subpartition by hash(second(col1)) subpartitions 2 
 
7908
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
7909
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
7910
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
7911
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
7912
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
7913
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
7914
);
 
7915
create table t6 (colint int, col1 time) engine='MYISAM' 
 
7916
partition by range(colint) 
 
7917
(partition p0 values less than (second('18:30:14')),
 
7918
partition p1 values less than maxvalue);
 
7919
-------------------------------------------------------------------------
 
7920
---  Access tables with second(col1) 
 
7921
-------------------------------------------------------------------------
 
7922
insert into t1 values ('09:09:09');
 
7923
insert into t1 values ('14:30:20');
 
7924
insert into t2 values ('09:09:09');
 
7925
insert into t2 values ('14:30:20');
 
7926
insert into t2 values ('21:59:22');
 
7927
insert into t3 values ('09:09:09');
 
7928
insert into t3 values ('14:30:20');
 
7929
insert into t3 values ('21:59:22');
 
7930
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4;
 
7931
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5;
 
7932
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6;
 
7933
select second(col1) from t1 order by col1;
 
7934
second(col1)
 
7935
9
 
7936
20
 
7937
select * from t1 order by col1;
 
7938
col1
 
7939
09:09:09
 
7940
14:30:20
 
7941
select * from t2 order by col1;
 
7942
col1
 
7943
09:09:09
 
7944
14:30:20
 
7945
21:59:22
 
7946
select * from t3 order by col1;
 
7947
col1
 
7948
09:09:09
 
7949
14:30:20
 
7950
21:59:22
 
7951
select * from t4 order by colint;
 
7952
colint  col1
 
7953
1       09:09:15
 
7954
2       04:30:01
 
7955
3       00:59:22
 
7956
4       05:30:34
 
7957
select * from t5 order by colint;
 
7958
colint  col1
 
7959
1       09:09:15
 
7960
2       04:30:01
 
7961
3       00:59:22
 
7962
4       05:30:34
 
7963
select * from t6 order by colint;
 
7964
colint  col1
 
7965
1       09:09:15
 
7966
2       04:30:01
 
7967
3       00:59:22
 
7968
4       05:30:34
 
7969
update t1 set col1='10:22:33' where col1='09:09:09';
 
7970
update t2 set col1='10:22:33' where col1='09:09:09';
 
7971
update t3 set col1='10:22:33' where col1='09:09:09';
 
7972
update t4 set col1='10:22:33' where col1='09:09:09';
 
7973
update t5 set col1='10:22:33' where col1='09:09:09';
 
7974
update t6 set col1='10:22:33' where col1='09:09:09';
 
7975
select * from t1 order by col1;
 
7976
col1
 
7977
10:22:33
 
7978
14:30:20
 
7979
select * from t2 order by col1;
 
7980
col1
 
7981
10:22:33
 
7982
14:30:20
 
7983
21:59:22
 
7984
select * from t3 order by col1;
 
7985
col1
 
7986
10:22:33
 
7987
14:30:20
 
7988
21:59:22
 
7989
select * from t4 order by colint;
 
7990
colint  col1
 
7991
1       09:09:15
 
7992
2       04:30:01
 
7993
3       00:59:22
 
7994
4       05:30:34
 
7995
select * from t5 order by colint;
 
7996
colint  col1
 
7997
1       09:09:15
 
7998
2       04:30:01
 
7999
3       00:59:22
 
8000
4       05:30:34
 
8001
select * from t6 order by colint;
 
8002
colint  col1
 
8003
1       09:09:15
 
8004
2       04:30:01
 
8005
3       00:59:22
 
8006
4       05:30:34
 
8007
-------------------------------------------------------------------------
 
8008
---  Alter tables with second(col1)
 
8009
-------------------------------------------------------------------------
 
8010
drop table if exists t11 ;
 
8011
drop table if exists t22 ;
 
8012
drop table if exists t33 ;
 
8013
drop table if exists t44 ;
 
8014
drop table if exists t55 ;
 
8015
drop table if exists t66 ;
 
8016
create table t11 engine='MYISAM' as select * from t1;
 
8017
create table t22 engine='MYISAM' as select * from t2;
 
8018
create table t33 engine='MYISAM' as select * from t3;
 
8019
create table t44 engine='MYISAM' as select * from t4;
 
8020
create table t55 engine='MYISAM' as select * from t5;
 
8021
create table t66 engine='MYISAM' as select * from t6;
 
8022
alter table t11
 
8023
partition by range(second(col1)) 
 
8024
(partition p0 values less than (15),
 
8025
partition p1 values less than maxvalue);
 
8026
alter table t22
 
8027
partition by list(second(col1)) 
 
8028
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
8029
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
8030
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
8031
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
8032
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
8033
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
8034
);
 
8035
alter table t33
 
8036
partition by hash(second(col1));
 
8037
alter table t44
 
8038
partition by range(colint) 
 
8039
subpartition by hash(second(col1)) subpartitions 2 
 
8040
(partition p0 values less than (15),
 
8041
partition p1 values less than maxvalue);
 
8042
alter table t55
 
8043
partition by list(colint)
 
8044
subpartition by hash(second(col1)) subpartitions 2 
 
8045
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
8046
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
8047
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
8048
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
8049
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
8050
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
8051
);
 
8052
alter table t66
 
8053
partition by range(colint) 
 
8054
(partition p0 values less than (second('18:30:14')),
 
8055
partition p1 values less than maxvalue);
 
8056
select * from t11 order by col1;
 
8057
col1
 
8058
10:22:33
 
8059
14:30:20
 
8060
select * from t22 order by col1;
 
8061
col1
 
8062
10:22:33
 
8063
14:30:20
 
8064
21:59:22
 
8065
select * from t33 order by col1;
 
8066
col1
 
8067
10:22:33
 
8068
14:30:20
 
8069
21:59:22
 
8070
select * from t44 order by colint;
 
8071
colint  col1
 
8072
1       09:09:15
 
8073
2       04:30:01
 
8074
3       00:59:22
 
8075
4       05:30:34
 
8076
select * from t55 order by colint;
 
8077
colint  col1
 
8078
1       09:09:15
 
8079
2       04:30:01
 
8080
3       00:59:22
 
8081
4       05:30:34
 
8082
select * from t66 order by colint;
 
8083
colint  col1
 
8084
1       09:09:15
 
8085
2       04:30:01
 
8086
3       00:59:22
 
8087
4       05:30:34
 
8088
---------------------------
 
8089
---- some alter table begin
 
8090
---------------------------
 
8091
alter table t11
 
8092
reorganize partition p0,p1 into
 
8093
(partition s1 values less than maxvalue);
 
8094
select * from t11 order by col1;
 
8095
col1
 
8096
10:22:33
 
8097
14:30:20
 
8098
alter table t11
 
8099
reorganize partition s1 into
 
8100
(partition p0 values less than (15),
 
8101
partition p1 values less than maxvalue);
 
8102
select * from t11 order by col1;
 
8103
col1
 
8104
10:22:33
 
8105
14:30:20
 
8106
alter table t55
 
8107
partition by list(colint)
 
8108
subpartition by hash(second(col1)) subpartitions 5 
 
8109
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
8110
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
8111
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
8112
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
8113
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
8114
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
8115
);
 
8116
show create table t55;
 
8117
Table   Create Table
 
8118
t55     CREATE TABLE `t55` (
 
8119
  `colint` int(11) DEFAULT NULL,
 
8120
  `col1` time DEFAULT NULL
 
8121
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (second(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
 
8122
select * from t55 order by colint;
 
8123
colint  col1
 
8124
1       09:09:15
 
8125
2       04:30:01
 
8126
3       00:59:22
 
8127
4       05:30:34
 
8128
alter table t66
 
8129
reorganize partition p0,p1 into
 
8130
(partition s1 values less than maxvalue);
 
8131
select * from t66 order by colint;
 
8132
colint  col1
 
8133
1       09:09:15
 
8134
2       04:30:01
 
8135
3       00:59:22
 
8136
4       05:30:34
 
8137
alter table t66
 
8138
reorganize partition s1 into
 
8139
(partition p0 values less than (second('18:30:14')),
 
8140
partition p1 values less than maxvalue);
 
8141
select * from t66 order by colint;
 
8142
colint  col1
 
8143
1       09:09:15
 
8144
2       04:30:01
 
8145
3       00:59:22
 
8146
4       05:30:34
 
8147
alter table t66
 
8148
reorganize partition p0,p1 into
 
8149
(partition s1 values less than maxvalue);
 
8150
select * from t66 order by colint;
 
8151
colint  col1
 
8152
1       09:09:15
 
8153
2       04:30:01
 
8154
3       00:59:22
 
8155
4       05:30:34
 
8156
alter table t66
 
8157
reorganize partition s1 into
 
8158
(partition p0 values less than (second('18:30:14')),
 
8159
partition p1 values less than maxvalue);
 
8160
select * from t66 order by colint;
 
8161
colint  col1
 
8162
1       09:09:15
 
8163
2       04:30:01
 
8164
3       00:59:22
 
8165
4       05:30:34
 
8166
-------------------------------------------------------------------------
 
8167
---  Delete rows and partitions of tables with second(col1)
 
8168
-------------------------------------------------------------------------
 
8169
delete from t1 where col1='14:30:20';
 
8170
delete from t2 where col1='14:30:20';
 
8171
delete from t3 where col1='14:30:20';
 
8172
delete from t4 where col1='14:30:20';
 
8173
delete from t5 where col1='14:30:20';
 
8174
delete from t6 where col1='14:30:20';
 
8175
select * from t1 order by col1;
 
8176
col1
 
8177
10:22:33
 
8178
select * from t2 order by col1;
 
8179
col1
 
8180
10:22:33
 
8181
21:59:22
 
8182
select * from t3 order by col1;
 
8183
col1
 
8184
10:22:33
 
8185
21:59:22
 
8186
select * from t4 order by colint;
 
8187
colint  col1
 
8188
1       09:09:15
 
8189
2       04:30:01
 
8190
3       00:59:22
 
8191
4       05:30:34
 
8192
select * from t5 order by colint;
 
8193
colint  col1
 
8194
1       09:09:15
 
8195
2       04:30:01
 
8196
3       00:59:22
 
8197
4       05:30:34
 
8198
insert into t1 values ('14:30:20');
 
8199
insert into t2 values ('14:30:20');
 
8200
insert into t3 values ('14:30:20');
 
8201
insert into t4 values (60,'14:30:20');
 
8202
insert into t5 values (60,'14:30:20');
 
8203
insert into t6 values (60,'14:30:20');
 
8204
select * from t1 order by col1;
 
8205
col1
 
8206
10:22:33
 
8207
14:30:20
 
8208
select * from t2 order by col1;
 
8209
col1
 
8210
10:22:33
 
8211
14:30:20
 
8212
21:59:22
 
8213
select * from t3 order by col1;
 
8214
col1
 
8215
10:22:33
 
8216
14:30:20
 
8217
21:59:22
 
8218
select * from t4 order by colint;
 
8219
colint  col1
 
8220
1       09:09:15
 
8221
2       04:30:01
 
8222
3       00:59:22
 
8223
4       05:30:34
 
8224
60      14:30:20
 
8225
select * from t5 order by colint;
 
8226
colint  col1
 
8227
1       09:09:15
 
8228
2       04:30:01
 
8229
3       00:59:22
 
8230
4       05:30:34
 
8231
60      14:30:20
 
8232
select * from t6 order by colint;
 
8233
colint  col1
 
8234
1       09:09:15
 
8235
2       04:30:01
 
8236
3       00:59:22
 
8237
4       05:30:34
 
8238
60      14:30:20
 
8239
alter table t1 drop partition p0;
 
8240
alter table t2 drop partition p0;
 
8241
alter table t4 drop partition p0;
 
8242
alter table t5 drop partition p0;
 
8243
alter table t6 drop partition p0;
 
8244
select * from t1 order by col1;
 
8245
col1
 
8246
10:22:33
 
8247
14:30:20
 
8248
select * from t2 order by col1;
 
8249
col1
 
8250
10:22:33
 
8251
14:30:20
 
8252
21:59:22
 
8253
select * from t3 order by col1;
 
8254
col1
 
8255
10:22:33
 
8256
14:30:20
 
8257
21:59:22
 
8258
select * from t4 order by colint;
 
8259
colint  col1
 
8260
60      14:30:20
 
8261
select * from t5 order by colint;
 
8262
colint  col1
 
8263
60      14:30:20
 
8264
select * from t6 order by colint;
 
8265
colint  col1
 
8266
60      14:30:20
 
8267
-------------------------------------------------------------------------
 
8268
---  Delete rows and partitions of tables with second(col1)
 
8269
-------------------------------------------------------------------------
 
8270
delete from t11 where col1='14:30:20';
 
8271
delete from t22 where col1='14:30:20';
 
8272
delete from t33 where col1='14:30:20';
 
8273
delete from t44 where col1='14:30:20';
 
8274
delete from t55 where col1='14:30:20';
 
8275
delete from t66 where col1='14:30:20';
 
8276
select * from t11 order by col1;
 
8277
col1
 
8278
10:22:33
 
8279
select * from t22 order by col1;
 
8280
col1
 
8281
10:22:33
 
8282
21:59:22
 
8283
select * from t33 order by col1;
 
8284
col1
 
8285
10:22:33
 
8286
21:59:22
 
8287
select * from t44 order by colint;
 
8288
colint  col1
 
8289
1       09:09:15
 
8290
2       04:30:01
 
8291
3       00:59:22
 
8292
4       05:30:34
 
8293
select * from t55 order by colint;
 
8294
colint  col1
 
8295
1       09:09:15
 
8296
2       04:30:01
 
8297
3       00:59:22
 
8298
4       05:30:34
 
8299
insert into t11 values ('14:30:20');
 
8300
insert into t22 values ('14:30:20');
 
8301
insert into t33 values ('14:30:20');
 
8302
insert into t44 values (60,'14:30:20');
 
8303
insert into t55 values (60,'14:30:20');
 
8304
insert into t66 values (60,'14:30:20');
 
8305
select * from t11 order by col1;
 
8306
col1
 
8307
10:22:33
 
8308
14:30:20
 
8309
select * from t22 order by col1;
 
8310
col1
 
8311
10:22:33
 
8312
14:30:20
 
8313
21:59:22
 
8314
select * from t33 order by col1;
 
8315
col1
 
8316
10:22:33
 
8317
14:30:20
 
8318
21:59:22
 
8319
select * from t44 order by colint;
 
8320
colint  col1
 
8321
1       09:09:15
 
8322
2       04:30:01
 
8323
3       00:59:22
 
8324
4       05:30:34
 
8325
60      14:30:20
 
8326
select * from t55 order by colint;
 
8327
colint  col1
 
8328
1       09:09:15
 
8329
2       04:30:01
 
8330
3       00:59:22
 
8331
4       05:30:34
 
8332
60      14:30:20
 
8333
select * from t66 order by colint;
 
8334
colint  col1
 
8335
1       09:09:15
 
8336
2       04:30:01
 
8337
3       00:59:22
 
8338
4       05:30:34
 
8339
60      14:30:20
 
8340
alter table t11 drop partition p0;
 
8341
alter table t22 drop partition p0;
 
8342
alter table t44 drop partition p0;
 
8343
alter table t55 drop partition p0;
 
8344
alter table t66 drop partition p0;
 
8345
select * from t11 order by col1;
 
8346
col1
 
8347
10:22:33
 
8348
14:30:20
 
8349
select * from t22 order by col1;
 
8350
col1
 
8351
10:22:33
 
8352
14:30:20
 
8353
21:59:22
 
8354
select * from t33 order by col1;
 
8355
col1
 
8356
10:22:33
 
8357
14:30:20
 
8358
21:59:22
 
8359
select * from t44 order by colint;
 
8360
colint  col1
 
8361
60      14:30:20
 
8362
select * from t55 order by colint;
 
8363
colint  col1
 
8364
60      14:30:20
 
8365
select * from t66 order by colint;
 
8366
colint  col1
 
8367
60      14:30:20
 
8368
-------------------------
 
8369
---- some alter table end
 
8370
-------------------------
 
8371
drop table if exists t1 ;
 
8372
drop table if exists t2 ;
 
8373
drop table if exists t3 ;
 
8374
drop table if exists t4 ;
 
8375
drop table if exists t5 ;
 
8376
drop table if exists t6 ;
 
8377
drop table if exists t11 ;
 
8378
drop table if exists t22 ;
 
8379
drop table if exists t33 ;
 
8380
drop table if exists t44 ;
 
8381
drop table if exists t55 ;
 
8382
drop table if exists t66 ;
 
8383
-------------------------------------------------------------------------
 
8384
---  second(col1)  in partition with coltype  char(30)
 
8385
-------------------------------------------------------------------------
 
8386
drop table if exists t1 ;
 
8387
drop table if exists t2 ;
 
8388
drop table if exists t3 ;
 
8389
drop table if exists t4 ;
 
8390
drop table if exists t5 ;
 
8391
drop table if exists t6 ;
 
8392
-------------------------------------------------------------------------
 
8393
---  Create tables with second(col1)
 
8394
-------------------------------------------------------------------------
 
8395
create table t1 (col1 char(30)) engine='MYISAM' 
 
8396
partition by range(second(col1)) 
 
8397
(partition p0 values less than (15),
 
8398
partition p1 values less than maxvalue);
 
8399
create table t2 (col1 char(30)) engine='MYISAM' 
 
8400
partition by list(second(col1)) 
 
8401
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
8402
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
8403
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
8404
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
8405
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
8406
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
8407
);
 
8408
create table t3 (col1 char(30)) engine='MYISAM' 
 
8409
partition by hash(second(col1));
 
8410
create table t4 (colint int, col1 char(30)) engine='MYISAM' 
 
8411
partition by range(colint) 
 
8412
subpartition by hash(second(col1)) subpartitions 2 
 
8413
(partition p0 values less than (15),
 
8414
partition p1 values less than maxvalue);
 
8415
create table t5 (colint int, col1 char(30)) engine='MYISAM' 
 
8416
partition by list(colint)
 
8417
subpartition by hash(second(col1)) subpartitions 2 
 
8418
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
8419
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
8420
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
8421
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
8422
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
8423
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
8424
);
 
8425
create table t6 (colint int, col1 char(30)) engine='MYISAM' 
 
8426
partition by range(colint) 
 
8427
(partition p0 values less than (second('18:30:14')),
 
8428
partition p1 values less than maxvalue);
 
8429
-------------------------------------------------------------------------
 
8430
---  Access tables with second(col1) 
 
8431
-------------------------------------------------------------------------
 
8432
insert into t1 values ('09:09:09');
 
8433
insert into t1 values ('14:30:20');
 
8434
insert into t2 values ('09:09:09');
 
8435
insert into t2 values ('14:30:20');
 
8436
insert into t2 values ('21:59:22');
 
8437
insert into t3 values ('09:09:09');
 
8438
insert into t3 values ('14:30:20');
 
8439
insert into t3 values ('21:59:22');
 
8440
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4;
 
8441
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5;
 
8442
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6;
 
8443
select second(col1) from t1 order by col1;
 
8444
second(col1)
 
8445
9
 
8446
20
 
8447
select * from t1 order by col1;
 
8448
col1
 
8449
09:09:09
 
8450
14:30:20
 
8451
select * from t2 order by col1;
 
8452
col1
 
8453
09:09:09
 
8454
14:30:20
 
8455
21:59:22
 
8456
select * from t3 order by col1;
 
8457
col1
 
8458
09:09:09
 
8459
14:30:20
 
8460
21:59:22
 
8461
select * from t4 order by colint;
 
8462
colint  col1
 
8463
1       09:09:15.000002
 
8464
2       04:30:01.000018
 
8465
3       00:59:22.000024
 
8466
4       05:30:34.000037
 
8467
select * from t5 order by colint;
 
8468
colint  col1
 
8469
1       09:09:15.000002
 
8470
2       04:30:01.000018
 
8471
3       00:59:22.000024
 
8472
4       05:30:34.000037
 
8473
select * from t6 order by colint;
 
8474
colint  col1
 
8475
1       09:09:15.000002
 
8476
2       04:30:01.000018
 
8477
3       00:59:22.000024
 
8478
4       05:30:34.000037
 
8479
update t1 set col1='10:22:33' where col1='09:09:09';
 
8480
update t2 set col1='10:22:33' where col1='09:09:09';
 
8481
update t3 set col1='10:22:33' where col1='09:09:09';
 
8482
update t4 set col1='10:22:33' where col1='09:09:09';
 
8483
update t5 set col1='10:22:33' where col1='09:09:09';
 
8484
update t6 set col1='10:22:33' where col1='09:09:09';
 
8485
select * from t1 order by col1;
 
8486
col1
 
8487
10:22:33
 
8488
14:30:20
 
8489
select * from t2 order by col1;
 
8490
col1
 
8491
10:22:33
 
8492
14:30:20
 
8493
21:59:22
 
8494
select * from t3 order by col1;
 
8495
col1
 
8496
10:22:33
 
8497
14:30:20
 
8498
21:59:22
 
8499
select * from t4 order by colint;
 
8500
colint  col1
 
8501
1       09:09:15.000002
 
8502
2       04:30:01.000018
 
8503
3       00:59:22.000024
 
8504
4       05:30:34.000037
 
8505
select * from t5 order by colint;
 
8506
colint  col1
 
8507
1       09:09:15.000002
 
8508
2       04:30:01.000018
 
8509
3       00:59:22.000024
 
8510
4       05:30:34.000037
 
8511
select * from t6 order by colint;
 
8512
colint  col1
 
8513
1       09:09:15.000002
 
8514
2       04:30:01.000018
 
8515
3       00:59:22.000024
 
8516
4       05:30:34.000037
 
8517
-------------------------------------------------------------------------
 
8518
---  Alter tables with second(col1)
 
8519
-------------------------------------------------------------------------
 
8520
drop table if exists t11 ;
 
8521
drop table if exists t22 ;
 
8522
drop table if exists t33 ;
 
8523
drop table if exists t44 ;
 
8524
drop table if exists t55 ;
 
8525
drop table if exists t66 ;
 
8526
create table t11 engine='MYISAM' as select * from t1;
 
8527
create table t22 engine='MYISAM' as select * from t2;
 
8528
create table t33 engine='MYISAM' as select * from t3;
 
8529
create table t44 engine='MYISAM' as select * from t4;
 
8530
create table t55 engine='MYISAM' as select * from t5;
 
8531
create table t66 engine='MYISAM' as select * from t6;
 
8532
alter table t11
 
8533
partition by range(second(col1)) 
 
8534
(partition p0 values less than (15),
 
8535
partition p1 values less than maxvalue);
 
8536
alter table t22
 
8537
partition by list(second(col1)) 
 
8538
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
8539
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
8540
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
8541
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
8542
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
8543
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
8544
);
 
8545
alter table t33
 
8546
partition by hash(second(col1));
 
8547
alter table t44
 
8548
partition by range(colint) 
 
8549
subpartition by hash(second(col1)) subpartitions 2 
 
8550
(partition p0 values less than (15),
 
8551
partition p1 values less than maxvalue);
 
8552
alter table t55
 
8553
partition by list(colint)
 
8554
subpartition by hash(second(col1)) subpartitions 2 
 
8555
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
8556
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
8557
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
8558
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
8559
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
8560
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
8561
);
 
8562
alter table t66
 
8563
partition by range(colint) 
 
8564
(partition p0 values less than (second('18:30:14')),
 
8565
partition p1 values less than maxvalue);
 
8566
select * from t11 order by col1;
 
8567
col1
 
8568
10:22:33
 
8569
14:30:20
 
8570
select * from t22 order by col1;
 
8571
col1
 
8572
10:22:33
 
8573
14:30:20
 
8574
21:59:22
 
8575
select * from t33 order by col1;
 
8576
col1
 
8577
10:22:33
 
8578
14:30:20
 
8579
21:59:22
 
8580
select * from t44 order by colint;
 
8581
colint  col1
 
8582
1       09:09:15.000002
 
8583
2       04:30:01.000018
 
8584
3       00:59:22.000024
 
8585
4       05:30:34.000037
 
8586
select * from t55 order by colint;
 
8587
colint  col1
 
8588
1       09:09:15.000002
 
8589
2       04:30:01.000018
 
8590
3       00:59:22.000024
 
8591
4       05:30:34.000037
 
8592
select * from t66 order by colint;
 
8593
colint  col1
 
8594
1       09:09:15.000002
 
8595
2       04:30:01.000018
 
8596
3       00:59:22.000024
 
8597
4       05:30:34.000037
 
8598
---------------------------
 
8599
---- some alter table begin
 
8600
---------------------------
 
8601
alter table t11
 
8602
reorganize partition p0,p1 into
 
8603
(partition s1 values less than maxvalue);
 
8604
select * from t11 order by col1;
 
8605
col1
 
8606
10:22:33
 
8607
14:30:20
 
8608
alter table t11
 
8609
reorganize partition s1 into
 
8610
(partition p0 values less than (15),
 
8611
partition p1 values less than maxvalue);
 
8612
select * from t11 order by col1;
 
8613
col1
 
8614
10:22:33
 
8615
14:30:20
 
8616
alter table t55
 
8617
partition by list(colint)
 
8618
subpartition by hash(second(col1)) subpartitions 5 
 
8619
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
8620
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
8621
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
8622
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
8623
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
8624
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
8625
);
 
8626
show create table t55;
 
8627
Table   Create Table
 
8628
t55     CREATE TABLE `t55` (
 
8629
  `colint` int(11) DEFAULT NULL,
 
8630
  `col1` char(30) DEFAULT NULL
 
8631
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (second(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
 
8632
select * from t55 order by colint;
 
8633
colint  col1
 
8634
1       09:09:15.000002
 
8635
2       04:30:01.000018
 
8636
3       00:59:22.000024
 
8637
4       05:30:34.000037
 
8638
alter table t66
 
8639
reorganize partition p0,p1 into
 
8640
(partition s1 values less than maxvalue);
 
8641
select * from t66 order by colint;
 
8642
colint  col1
 
8643
1       09:09:15.000002
 
8644
2       04:30:01.000018
 
8645
3       00:59:22.000024
 
8646
4       05:30:34.000037
 
8647
alter table t66
 
8648
reorganize partition s1 into
 
8649
(partition p0 values less than (second('18:30:14')),
 
8650
partition p1 values less than maxvalue);
 
8651
select * from t66 order by colint;
 
8652
colint  col1
 
8653
1       09:09:15.000002
 
8654
2       04:30:01.000018
 
8655
3       00:59:22.000024
 
8656
4       05:30:34.000037
 
8657
alter table t66
 
8658
reorganize partition p0,p1 into
 
8659
(partition s1 values less than maxvalue);
 
8660
select * from t66 order by colint;
 
8661
colint  col1
 
8662
1       09:09:15.000002
 
8663
2       04:30:01.000018
 
8664
3       00:59:22.000024
 
8665
4       05:30:34.000037
 
8666
alter table t66
 
8667
reorganize partition s1 into
 
8668
(partition p0 values less than (second('18:30:14')),
 
8669
partition p1 values less than maxvalue);
 
8670
select * from t66 order by colint;
 
8671
colint  col1
 
8672
1       09:09:15.000002
 
8673
2       04:30:01.000018
 
8674
3       00:59:22.000024
 
8675
4       05:30:34.000037
 
8676
-------------------------------------------------------------------------
 
8677
---  Delete rows and partitions of tables with second(col1)
 
8678
-------------------------------------------------------------------------
 
8679
delete from t1 where col1='14:30:20';
 
8680
delete from t2 where col1='14:30:20';
 
8681
delete from t3 where col1='14:30:20';
 
8682
delete from t4 where col1='14:30:20';
 
8683
delete from t5 where col1='14:30:20';
 
8684
delete from t6 where col1='14:30:20';
 
8685
select * from t1 order by col1;
 
8686
col1
 
8687
10:22:33
 
8688
select * from t2 order by col1;
 
8689
col1
 
8690
10:22:33
 
8691
21:59:22
 
8692
select * from t3 order by col1;
 
8693
col1
 
8694
10:22:33
 
8695
21:59:22
 
8696
select * from t4 order by colint;
 
8697
colint  col1
 
8698
1       09:09:15.000002
 
8699
2       04:30:01.000018
 
8700
3       00:59:22.000024
 
8701
4       05:30:34.000037
 
8702
select * from t5 order by colint;
 
8703
colint  col1
 
8704
1       09:09:15.000002
 
8705
2       04:30:01.000018
 
8706
3       00:59:22.000024
 
8707
4       05:30:34.000037
 
8708
insert into t1 values ('14:30:20');
 
8709
insert into t2 values ('14:30:20');
 
8710
insert into t3 values ('14:30:20');
 
8711
insert into t4 values (60,'14:30:20');
 
8712
insert into t5 values (60,'14:30:20');
 
8713
insert into t6 values (60,'14:30:20');
 
8714
select * from t1 order by col1;
 
8715
col1
 
8716
10:22:33
 
8717
14:30:20
 
8718
select * from t2 order by col1;
 
8719
col1
 
8720
10:22:33
 
8721
14:30:20
 
8722
21:59:22
 
8723
select * from t3 order by col1;
 
8724
col1
 
8725
10:22:33
 
8726
14:30:20
 
8727
21:59:22
 
8728
select * from t4 order by colint;
 
8729
colint  col1
 
8730
1       09:09:15.000002
 
8731
2       04:30:01.000018
 
8732
3       00:59:22.000024
 
8733
4       05:30:34.000037
 
8734
60      14:30:20
 
8735
select * from t5 order by colint;
 
8736
colint  col1
 
8737
1       09:09:15.000002
 
8738
2       04:30:01.000018
 
8739
3       00:59:22.000024
 
8740
4       05:30:34.000037
 
8741
60      14:30:20
 
8742
select * from t6 order by colint;
 
8743
colint  col1
 
8744
1       09:09:15.000002
 
8745
2       04:30:01.000018
 
8746
3       00:59:22.000024
 
8747
4       05:30:34.000037
 
8748
60      14:30:20
 
8749
alter table t1 drop partition p0;
 
8750
alter table t2 drop partition p0;
 
8751
alter table t4 drop partition p0;
 
8752
alter table t5 drop partition p0;
 
8753
alter table t6 drop partition p0;
 
8754
select * from t1 order by col1;
 
8755
col1
 
8756
10:22:33
 
8757
14:30:20
 
8758
select * from t2 order by col1;
 
8759
col1
 
8760
10:22:33
 
8761
14:30:20
 
8762
21:59:22
 
8763
select * from t3 order by col1;
 
8764
col1
 
8765
10:22:33
 
8766
14:30:20
 
8767
21:59:22
 
8768
select * from t4 order by colint;
 
8769
colint  col1
 
8770
60      14:30:20
 
8771
select * from t5 order by colint;
 
8772
colint  col1
 
8773
60      14:30:20
 
8774
select * from t6 order by colint;
 
8775
colint  col1
 
8776
60      14:30:20
 
8777
-------------------------------------------------------------------------
 
8778
---  Delete rows and partitions of tables with second(col1)
 
8779
-------------------------------------------------------------------------
 
8780
delete from t11 where col1='14:30:20';
 
8781
delete from t22 where col1='14:30:20';
 
8782
delete from t33 where col1='14:30:20';
 
8783
delete from t44 where col1='14:30:20';
 
8784
delete from t55 where col1='14:30:20';
 
8785
delete from t66 where col1='14:30:20';
 
8786
select * from t11 order by col1;
 
8787
col1
 
8788
10:22:33
 
8789
select * from t22 order by col1;
 
8790
col1
 
8791
10:22:33
 
8792
21:59:22
 
8793
select * from t33 order by col1;
 
8794
col1
 
8795
10:22:33
 
8796
21:59:22
 
8797
select * from t44 order by colint;
 
8798
colint  col1
 
8799
1       09:09:15.000002
 
8800
2       04:30:01.000018
 
8801
3       00:59:22.000024
 
8802
4       05:30:34.000037
 
8803
select * from t55 order by colint;
 
8804
colint  col1
 
8805
1       09:09:15.000002
 
8806
2       04:30:01.000018
 
8807
3       00:59:22.000024
 
8808
4       05:30:34.000037
 
8809
insert into t11 values ('14:30:20');
 
8810
insert into t22 values ('14:30:20');
 
8811
insert into t33 values ('14:30:20');
 
8812
insert into t44 values (60,'14:30:20');
 
8813
insert into t55 values (60,'14:30:20');
 
8814
insert into t66 values (60,'14:30:20');
 
8815
select * from t11 order by col1;
 
8816
col1
 
8817
10:22:33
 
8818
14:30:20
 
8819
select * from t22 order by col1;
 
8820
col1
 
8821
10:22:33
 
8822
14:30:20
 
8823
21:59:22
 
8824
select * from t33 order by col1;
 
8825
col1
 
8826
10:22:33
 
8827
14:30:20
 
8828
21:59:22
 
8829
select * from t44 order by colint;
 
8830
colint  col1
 
8831
1       09:09:15.000002
 
8832
2       04:30:01.000018
 
8833
3       00:59:22.000024
 
8834
4       05:30:34.000037
 
8835
60      14:30:20
 
8836
select * from t55 order by colint;
 
8837
colint  col1
 
8838
1       09:09:15.000002
 
8839
2       04:30:01.000018
 
8840
3       00:59:22.000024
 
8841
4       05:30:34.000037
 
8842
60      14:30:20
 
8843
select * from t66 order by colint;
 
8844
colint  col1
 
8845
1       09:09:15.000002
 
8846
2       04:30:01.000018
 
8847
3       00:59:22.000024
 
8848
4       05:30:34.000037
 
8849
60      14:30:20
 
8850
alter table t11 drop partition p0;
 
8851
alter table t22 drop partition p0;
 
8852
alter table t44 drop partition p0;
 
8853
alter table t55 drop partition p0;
 
8854
alter table t66 drop partition p0;
 
8855
select * from t11 order by col1;
 
8856
col1
 
8857
10:22:33
 
8858
14:30:20
 
8859
select * from t22 order by col1;
 
8860
col1
 
8861
10:22:33
 
8862
14:30:20
 
8863
21:59:22
 
8864
select * from t33 order by col1;
 
8865
col1
 
8866
10:22:33
 
8867
14:30:20
 
8868
21:59:22
 
8869
select * from t44 order by colint;
 
8870
colint  col1
 
8871
60      14:30:20
 
8872
select * from t55 order by colint;
 
8873
colint  col1
 
8874
60      14:30:20
 
8875
select * from t66 order by colint;
 
8876
colint  col1
 
8877
60      14:30:20
 
8878
-------------------------
 
8879
---- some alter table end
 
8880
-------------------------
 
8881
drop table if exists t1 ;
 
8882
drop table if exists t2 ;
 
8883
drop table if exists t3 ;
 
8884
drop table if exists t4 ;
 
8885
drop table if exists t5 ;
 
8886
drop table if exists t6 ;
 
8887
drop table if exists t11 ;
 
8888
drop table if exists t22 ;
 
8889
drop table if exists t33 ;
 
8890
drop table if exists t44 ;
 
8891
drop table if exists t55 ;
 
8892
drop table if exists t66 ;
 
8893
-------------------------------------------------------------------------
 
8894
---  month(col1)  in partition with coltype  date
 
8895
-------------------------------------------------------------------------
 
8896
drop table if exists t1 ;
 
8897
drop table if exists t2 ;
 
8898
drop table if exists t3 ;
 
8899
drop table if exists t4 ;
 
8900
drop table if exists t5 ;
 
8901
drop table if exists t6 ;
 
8902
-------------------------------------------------------------------------
 
8903
---  Create tables with month(col1)
 
8904
-------------------------------------------------------------------------
 
8905
create table t1 (col1 date) engine='MYISAM' 
 
8906
partition by range(month(col1)) 
 
8907
(partition p0 values less than (15),
 
8908
partition p1 values less than maxvalue);
 
8909
create table t2 (col1 date) engine='MYISAM' 
 
8910
partition by list(month(col1)) 
 
8911
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
8912
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
8913
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
8914
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
8915
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
8916
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
8917
);
 
8918
create table t3 (col1 date) engine='MYISAM' 
 
8919
partition by hash(month(col1));
 
8920
create table t4 (colint int, col1 date) engine='MYISAM' 
 
8921
partition by range(colint) 
 
8922
subpartition by hash(month(col1)) subpartitions 2 
 
8923
(partition p0 values less than (15),
 
8924
partition p1 values less than maxvalue);
 
8925
create table t5 (colint int, col1 date) engine='MYISAM' 
 
8926
partition by list(colint)
 
8927
subpartition by hash(month(col1)) subpartitions 2 
 
8928
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
8929
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
8930
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
8931
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
8932
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
8933
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
8934
);
 
8935
create table t6 (colint int, col1 date) engine='MYISAM' 
 
8936
partition by range(colint) 
 
8937
(partition p0 values less than (month('2006-10-14')),
 
8938
partition p1 values less than maxvalue);
 
8939
-------------------------------------------------------------------------
 
8940
---  Access tables with month(col1) 
 
8941
-------------------------------------------------------------------------
 
8942
insert into t1 values ('2006-01-03');
 
8943
insert into t1 values ('2006-12-17');
 
8944
insert into t2 values ('2006-01-03');
 
8945
insert into t2 values ('2006-12-17');
 
8946
insert into t2 values ('2006-05-25');
 
8947
insert into t3 values ('2006-01-03');
 
8948
insert into t3 values ('2006-12-17');
 
8949
insert into t3 values ('2006-05-25');
 
8950
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
 
8951
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
 
8952
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
 
8953
select month(col1) from t1 order by col1;
 
8954
month(col1)
 
8955
1
 
8956
12
 
8957
select * from t1 order by col1;
 
8958
col1
 
8959
2006-01-03
 
8960
2006-12-17
 
8961
select * from t2 order by col1;
 
8962
col1
 
8963
2006-01-03
 
8964
2006-05-25
 
8965
2006-12-17
 
8966
select * from t3 order by col1;
 
8967
col1
 
8968
2006-01-03
 
8969
2006-05-25
 
8970
2006-12-17
 
8971
select * from t4 order by colint;
 
8972
colint  col1
 
8973
1       2006-02-03
 
8974
2       2006-01-17
 
8975
3       2006-01-25
 
8976
4       2006-02-05
 
8977
select * from t5 order by colint;
 
8978
colint  col1
 
8979
1       2006-02-03
 
8980
2       2006-01-17
 
8981
3       2006-01-25
 
8982
4       2006-02-05
 
8983
select * from t6 order by colint;
 
8984
colint  col1
 
8985
1       2006-02-03
 
8986
2       2006-01-17
 
8987
3       2006-01-25
 
8988
4       2006-02-05
 
8989
update t1 set col1='2006-11-06' where col1='2006-01-03';
 
8990
update t2 set col1='2006-11-06' where col1='2006-01-03';
 
8991
update t3 set col1='2006-11-06' where col1='2006-01-03';
 
8992
update t4 set col1='2006-11-06' where col1='2006-01-03';
 
8993
update t5 set col1='2006-11-06' where col1='2006-01-03';
 
8994
update t6 set col1='2006-11-06' where col1='2006-01-03';
 
8995
select * from t1 order by col1;
 
8996
col1
 
8997
2006-11-06
 
8998
2006-12-17
 
8999
select * from t2 order by col1;
 
9000
col1
 
9001
2006-05-25
 
9002
2006-11-06
 
9003
2006-12-17
 
9004
select * from t3 order by col1;
 
9005
col1
 
9006
2006-05-25
 
9007
2006-11-06
 
9008
2006-12-17
 
9009
select * from t4 order by colint;
 
9010
colint  col1
 
9011
1       2006-02-03
 
9012
2       2006-01-17
 
9013
3       2006-01-25
 
9014
4       2006-02-05
 
9015
select * from t5 order by colint;
 
9016
colint  col1
 
9017
1       2006-02-03
 
9018
2       2006-01-17
 
9019
3       2006-01-25
 
9020
4       2006-02-05
 
9021
select * from t6 order by colint;
 
9022
colint  col1
 
9023
1       2006-02-03
 
9024
2       2006-01-17
 
9025
3       2006-01-25
 
9026
4       2006-02-05
 
9027
-------------------------------------------------------------------------
 
9028
---  Alter tables with month(col1)
 
9029
-------------------------------------------------------------------------
 
9030
drop table if exists t11 ;
 
9031
drop table if exists t22 ;
 
9032
drop table if exists t33 ;
 
9033
drop table if exists t44 ;
 
9034
drop table if exists t55 ;
 
9035
drop table if exists t66 ;
 
9036
create table t11 engine='MYISAM' as select * from t1;
 
9037
create table t22 engine='MYISAM' as select * from t2;
 
9038
create table t33 engine='MYISAM' as select * from t3;
 
9039
create table t44 engine='MYISAM' as select * from t4;
 
9040
create table t55 engine='MYISAM' as select * from t5;
 
9041
create table t66 engine='MYISAM' as select * from t6;
 
9042
alter table t11
 
9043
partition by range(month(col1)) 
 
9044
(partition p0 values less than (15),
 
9045
partition p1 values less than maxvalue);
 
9046
alter table t22
 
9047
partition by list(month(col1)) 
 
9048
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
9049
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
9050
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
9051
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
9052
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
9053
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
9054
);
 
9055
alter table t33
 
9056
partition by hash(month(col1));
 
9057
alter table t44
 
9058
partition by range(colint) 
 
9059
subpartition by hash(month(col1)) subpartitions 2 
 
9060
(partition p0 values less than (15),
 
9061
partition p1 values less than maxvalue);
 
9062
alter table t55
 
9063
partition by list(colint)
 
9064
subpartition by hash(month(col1)) subpartitions 2 
 
9065
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
9066
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
9067
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
9068
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
9069
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
9070
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
9071
);
 
9072
alter table t66
 
9073
partition by range(colint) 
 
9074
(partition p0 values less than (month('2006-10-14')),
 
9075
partition p1 values less than maxvalue);
 
9076
select * from t11 order by col1;
 
9077
col1
 
9078
2006-11-06
 
9079
2006-12-17
 
9080
select * from t22 order by col1;
 
9081
col1
 
9082
2006-05-25
 
9083
2006-11-06
 
9084
2006-12-17
 
9085
select * from t33 order by col1;
 
9086
col1
 
9087
2006-05-25
 
9088
2006-11-06
 
9089
2006-12-17
 
9090
select * from t44 order by colint;
 
9091
colint  col1
 
9092
1       2006-02-03
 
9093
2       2006-01-17
 
9094
3       2006-01-25
 
9095
4       2006-02-05
 
9096
select * from t55 order by colint;
 
9097
colint  col1
 
9098
1       2006-02-03
 
9099
2       2006-01-17
 
9100
3       2006-01-25
 
9101
4       2006-02-05
 
9102
select * from t66 order by colint;
 
9103
colint  col1
 
9104
1       2006-02-03
 
9105
2       2006-01-17
 
9106
3       2006-01-25
 
9107
4       2006-02-05
 
9108
---------------------------
 
9109
---- some alter table begin
 
9110
---------------------------
 
9111
alter table t11
 
9112
reorganize partition p0,p1 into
 
9113
(partition s1 values less than maxvalue);
 
9114
select * from t11 order by col1;
 
9115
col1
 
9116
2006-11-06
 
9117
2006-12-17
 
9118
alter table t11
 
9119
reorganize partition s1 into
 
9120
(partition p0 values less than (15),
 
9121
partition p1 values less than maxvalue);
 
9122
select * from t11 order by col1;
 
9123
col1
 
9124
2006-11-06
 
9125
2006-12-17
 
9126
alter table t55
 
9127
partition by list(colint)
 
9128
subpartition by hash(month(col1)) subpartitions 5 
 
9129
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
9130
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
9131
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
9132
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
9133
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
9134
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
9135
);
 
9136
show create table t55;
 
9137
Table   Create Table
 
9138
t55     CREATE TABLE `t55` (
 
9139
  `colint` int(11) DEFAULT NULL,
 
9140
  `col1` date DEFAULT NULL
 
9141
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (month(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
 
9142
select * from t55 order by colint;
 
9143
colint  col1
 
9144
1       2006-02-03
 
9145
2       2006-01-17
 
9146
3       2006-01-25
 
9147
4       2006-02-05
 
9148
alter table t66
 
9149
reorganize partition p0,p1 into
 
9150
(partition s1 values less than maxvalue);
 
9151
select * from t66 order by colint;
 
9152
colint  col1
 
9153
1       2006-02-03
 
9154
2       2006-01-17
 
9155
3       2006-01-25
 
9156
4       2006-02-05
 
9157
alter table t66
 
9158
reorganize partition s1 into
 
9159
(partition p0 values less than (month('2006-10-14')),
 
9160
partition p1 values less than maxvalue);
 
9161
select * from t66 order by colint;
 
9162
colint  col1
 
9163
1       2006-02-03
 
9164
2       2006-01-17
 
9165
3       2006-01-25
 
9166
4       2006-02-05
 
9167
alter table t66
 
9168
reorganize partition p0,p1 into
 
9169
(partition s1 values less than maxvalue);
 
9170
select * from t66 order by colint;
 
9171
colint  col1
 
9172
1       2006-02-03
 
9173
2       2006-01-17
 
9174
3       2006-01-25
 
9175
4       2006-02-05
 
9176
alter table t66
 
9177
reorganize partition s1 into
 
9178
(partition p0 values less than (month('2006-10-14')),
 
9179
partition p1 values less than maxvalue);
 
9180
select * from t66 order by colint;
 
9181
colint  col1
 
9182
1       2006-02-03
 
9183
2       2006-01-17
 
9184
3       2006-01-25
 
9185
4       2006-02-05
 
9186
-------------------------------------------------------------------------
 
9187
---  Delete rows and partitions of tables with month(col1)
 
9188
-------------------------------------------------------------------------
 
9189
delete from t1 where col1='2006-12-17';
 
9190
delete from t2 where col1='2006-12-17';
 
9191
delete from t3 where col1='2006-12-17';
 
9192
delete from t4 where col1='2006-12-17';
 
9193
delete from t5 where col1='2006-12-17';
 
9194
delete from t6 where col1='2006-12-17';
 
9195
select * from t1 order by col1;
 
9196
col1
 
9197
2006-11-06
 
9198
select * from t2 order by col1;
 
9199
col1
 
9200
2006-05-25
 
9201
2006-11-06
 
9202
select * from t3 order by col1;
 
9203
col1
 
9204
2006-05-25
 
9205
2006-11-06
 
9206
select * from t4 order by colint;
 
9207
colint  col1
 
9208
1       2006-02-03
 
9209
2       2006-01-17
 
9210
3       2006-01-25
 
9211
4       2006-02-05
 
9212
select * from t5 order by colint;
 
9213
colint  col1
 
9214
1       2006-02-03
 
9215
2       2006-01-17
 
9216
3       2006-01-25
 
9217
4       2006-02-05
 
9218
insert into t1 values ('2006-12-17');
 
9219
insert into t2 values ('2006-12-17');
 
9220
insert into t3 values ('2006-12-17');
 
9221
insert into t4 values (60,'2006-12-17');
 
9222
insert into t5 values (60,'2006-12-17');
 
9223
insert into t6 values (60,'2006-12-17');
 
9224
select * from t1 order by col1;
 
9225
col1
 
9226
2006-11-06
 
9227
2006-12-17
 
9228
select * from t2 order by col1;
 
9229
col1
 
9230
2006-05-25
 
9231
2006-11-06
 
9232
2006-12-17
 
9233
select * from t3 order by col1;
 
9234
col1
 
9235
2006-05-25
 
9236
2006-11-06
 
9237
2006-12-17
 
9238
select * from t4 order by colint;
 
9239
colint  col1
 
9240
1       2006-02-03
 
9241
2       2006-01-17
 
9242
3       2006-01-25
 
9243
4       2006-02-05
 
9244
60      2006-12-17
 
9245
select * from t5 order by colint;
 
9246
colint  col1
 
9247
1       2006-02-03
 
9248
2       2006-01-17
 
9249
3       2006-01-25
 
9250
4       2006-02-05
 
9251
60      2006-12-17
 
9252
select * from t6 order by colint;
 
9253
colint  col1
 
9254
1       2006-02-03
 
9255
2       2006-01-17
 
9256
3       2006-01-25
 
9257
4       2006-02-05
 
9258
60      2006-12-17
 
9259
alter table t1 drop partition p0;
 
9260
alter table t2 drop partition p0;
 
9261
alter table t4 drop partition p0;
 
9262
alter table t5 drop partition p0;
 
9263
alter table t6 drop partition p0;
 
9264
select * from t1 order by col1;
 
9265
col1
 
9266
select * from t2 order by col1;
 
9267
col1
 
9268
2006-11-06
 
9269
2006-12-17
 
9270
select * from t3 order by col1;
 
9271
col1
 
9272
2006-05-25
 
9273
2006-11-06
 
9274
2006-12-17
 
9275
select * from t4 order by colint;
 
9276
colint  col1
 
9277
60      2006-12-17
 
9278
select * from t5 order by colint;
 
9279
colint  col1
 
9280
60      2006-12-17
 
9281
select * from t6 order by colint;
 
9282
colint  col1
 
9283
60      2006-12-17
 
9284
-------------------------------------------------------------------------
 
9285
---  Delete rows and partitions of tables with month(col1)
 
9286
-------------------------------------------------------------------------
 
9287
delete from t11 where col1='2006-12-17';
 
9288
delete from t22 where col1='2006-12-17';
 
9289
delete from t33 where col1='2006-12-17';
 
9290
delete from t44 where col1='2006-12-17';
 
9291
delete from t55 where col1='2006-12-17';
 
9292
delete from t66 where col1='2006-12-17';
 
9293
select * from t11 order by col1;
 
9294
col1
 
9295
2006-11-06
 
9296
select * from t22 order by col1;
 
9297
col1
 
9298
2006-05-25
 
9299
2006-11-06
 
9300
select * from t33 order by col1;
 
9301
col1
 
9302
2006-05-25
 
9303
2006-11-06
 
9304
select * from t44 order by colint;
 
9305
colint  col1
 
9306
1       2006-02-03
 
9307
2       2006-01-17
 
9308
3       2006-01-25
 
9309
4       2006-02-05
 
9310
select * from t55 order by colint;
 
9311
colint  col1
 
9312
1       2006-02-03
 
9313
2       2006-01-17
 
9314
3       2006-01-25
 
9315
4       2006-02-05
 
9316
insert into t11 values ('2006-12-17');
 
9317
insert into t22 values ('2006-12-17');
 
9318
insert into t33 values ('2006-12-17');
 
9319
insert into t44 values (60,'2006-12-17');
 
9320
insert into t55 values (60,'2006-12-17');
 
9321
insert into t66 values (60,'2006-12-17');
 
9322
select * from t11 order by col1;
 
9323
col1
 
9324
2006-11-06
 
9325
2006-12-17
 
9326
select * from t22 order by col1;
 
9327
col1
 
9328
2006-05-25
 
9329
2006-11-06
 
9330
2006-12-17
 
9331
select * from t33 order by col1;
 
9332
col1
 
9333
2006-05-25
 
9334
2006-11-06
 
9335
2006-12-17
 
9336
select * from t44 order by colint;
 
9337
colint  col1
 
9338
1       2006-02-03
 
9339
2       2006-01-17
 
9340
3       2006-01-25
 
9341
4       2006-02-05
 
9342
60      2006-12-17
 
9343
select * from t55 order by colint;
 
9344
colint  col1
 
9345
1       2006-02-03
 
9346
2       2006-01-17
 
9347
3       2006-01-25
 
9348
4       2006-02-05
 
9349
60      2006-12-17
 
9350
select * from t66 order by colint;
 
9351
colint  col1
 
9352
1       2006-02-03
 
9353
2       2006-01-17
 
9354
3       2006-01-25
 
9355
4       2006-02-05
 
9356
60      2006-12-17
 
9357
alter table t11 drop partition p0;
 
9358
alter table t22 drop partition p0;
 
9359
alter table t44 drop partition p0;
 
9360
alter table t55 drop partition p0;
 
9361
alter table t66 drop partition p0;
 
9362
select * from t11 order by col1;
 
9363
col1
 
9364
select * from t22 order by col1;
 
9365
col1
 
9366
2006-11-06
 
9367
2006-12-17
 
9368
select * from t33 order by col1;
 
9369
col1
 
9370
2006-05-25
 
9371
2006-11-06
 
9372
2006-12-17
 
9373
select * from t44 order by colint;
 
9374
colint  col1
 
9375
60      2006-12-17
 
9376
select * from t55 order by colint;
 
9377
colint  col1
 
9378
60      2006-12-17
 
9379
select * from t66 order by colint;
 
9380
colint  col1
 
9381
60      2006-12-17
 
9382
-------------------------
 
9383
---- some alter table end
 
9384
-------------------------
 
9385
drop table if exists t1 ;
 
9386
drop table if exists t2 ;
 
9387
drop table if exists t3 ;
 
9388
drop table if exists t4 ;
 
9389
drop table if exists t5 ;
 
9390
drop table if exists t6 ;
 
9391
drop table if exists t11 ;
 
9392
drop table if exists t22 ;
 
9393
drop table if exists t33 ;
 
9394
drop table if exists t44 ;
 
9395
drop table if exists t55 ;
 
9396
drop table if exists t66 ;
 
9397
-------------------------------------------------------------------------
 
9398
---  quarter(col1)  in partition with coltype  date
 
9399
-------------------------------------------------------------------------
 
9400
drop table if exists t1 ;
 
9401
drop table if exists t2 ;
 
9402
drop table if exists t3 ;
 
9403
drop table if exists t4 ;
 
9404
drop table if exists t5 ;
 
9405
drop table if exists t6 ;
 
9406
-------------------------------------------------------------------------
 
9407
---  Create tables with quarter(col1)
 
9408
-------------------------------------------------------------------------
 
9409
create table t1 (col1 date) engine='MYISAM' 
 
9410
partition by range(quarter(col1)) 
 
9411
(partition p0 values less than (15),
 
9412
partition p1 values less than maxvalue);
 
9413
create table t2 (col1 date) engine='MYISAM' 
 
9414
partition by list(quarter(col1)) 
 
9415
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
9416
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
9417
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
9418
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
9419
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
9420
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
9421
);
 
9422
create table t3 (col1 date) engine='MYISAM' 
 
9423
partition by hash(quarter(col1));
 
9424
create table t4 (colint int, col1 date) engine='MYISAM' 
 
9425
partition by range(colint) 
 
9426
subpartition by hash(quarter(col1)) subpartitions 2 
 
9427
(partition p0 values less than (15),
 
9428
partition p1 values less than maxvalue);
 
9429
create table t5 (colint int, col1 date) engine='MYISAM' 
 
9430
partition by list(colint)
 
9431
subpartition by hash(quarter(col1)) subpartitions 2 
 
9432
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
9433
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
9434
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
9435
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
9436
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
9437
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
9438
);
 
9439
create table t6 (colint int, col1 date) engine='MYISAM' 
 
9440
partition by range(colint) 
 
9441
(partition p0 values less than (quarter('2006-10-14')),
 
9442
partition p1 values less than maxvalue);
 
9443
-------------------------------------------------------------------------
 
9444
---  Access tables with quarter(col1) 
 
9445
-------------------------------------------------------------------------
 
9446
insert into t1 values ('2006-01-03');
 
9447
insert into t1 values ('2006-12-17');
 
9448
insert into t2 values ('2006-01-03');
 
9449
insert into t2 values ('2006-12-17');
 
9450
insert into t2 values ('2006-09-25');
 
9451
insert into t3 values ('2006-01-03');
 
9452
insert into t3 values ('2006-12-17');
 
9453
insert into t3 values ('2006-09-25');
 
9454
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
 
9455
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
 
9456
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
 
9457
select quarter(col1) from t1 order by col1;
 
9458
quarter(col1)
 
9459
1
 
9460
4
 
9461
select * from t1 order by col1;
 
9462
col1
 
9463
2006-01-03
 
9464
2006-12-17
 
9465
select * from t2 order by col1;
 
9466
col1
 
9467
2006-01-03
 
9468
2006-09-25
 
9469
2006-12-17
 
9470
select * from t3 order by col1;
 
9471
col1
 
9472
2006-01-03
 
9473
2006-09-25
 
9474
2006-12-17
 
9475
select * from t4 order by colint;
 
9476
colint  col1
 
9477
1       2006-02-03
 
9478
2       2006-01-17
 
9479
3       2006-01-25
 
9480
4       2006-02-05
 
9481
select * from t5 order by colint;
 
9482
colint  col1
 
9483
1       2006-02-03
 
9484
2       2006-01-17
 
9485
3       2006-01-25
 
9486
4       2006-02-05
 
9487
select * from t6 order by colint;
 
9488
colint  col1
 
9489
1       2006-02-03
 
9490
2       2006-01-17
 
9491
3       2006-01-25
 
9492
4       2006-02-05
 
9493
update t1 set col1='2006-07-30' where col1='2006-01-03';
 
9494
update t2 set col1='2006-07-30' where col1='2006-01-03';
 
9495
update t3 set col1='2006-07-30' where col1='2006-01-03';
 
9496
update t4 set col1='2006-07-30' where col1='2006-01-03';
 
9497
update t5 set col1='2006-07-30' where col1='2006-01-03';
 
9498
update t6 set col1='2006-07-30' where col1='2006-01-03';
 
9499
select * from t1 order by col1;
 
9500
col1
 
9501
2006-07-30
 
9502
2006-12-17
 
9503
select * from t2 order by col1;
 
9504
col1
 
9505
2006-07-30
 
9506
2006-09-25
 
9507
2006-12-17
 
9508
select * from t3 order by col1;
 
9509
col1
 
9510
2006-07-30
 
9511
2006-09-25
 
9512
2006-12-17
 
9513
select * from t4 order by colint;
 
9514
colint  col1
 
9515
1       2006-02-03
 
9516
2       2006-01-17
 
9517
3       2006-01-25
 
9518
4       2006-02-05
 
9519
select * from t5 order by colint;
 
9520
colint  col1
 
9521
1       2006-02-03
 
9522
2       2006-01-17
 
9523
3       2006-01-25
 
9524
4       2006-02-05
 
9525
select * from t6 order by colint;
 
9526
colint  col1
 
9527
1       2006-02-03
 
9528
2       2006-01-17
 
9529
3       2006-01-25
 
9530
4       2006-02-05
 
9531
-------------------------------------------------------------------------
 
9532
---  Alter tables with quarter(col1)
 
9533
-------------------------------------------------------------------------
 
9534
drop table if exists t11 ;
 
9535
drop table if exists t22 ;
 
9536
drop table if exists t33 ;
 
9537
drop table if exists t44 ;
 
9538
drop table if exists t55 ;
 
9539
drop table if exists t66 ;
 
9540
create table t11 engine='MYISAM' as select * from t1;
 
9541
create table t22 engine='MYISAM' as select * from t2;
 
9542
create table t33 engine='MYISAM' as select * from t3;
 
9543
create table t44 engine='MYISAM' as select * from t4;
 
9544
create table t55 engine='MYISAM' as select * from t5;
 
9545
create table t66 engine='MYISAM' as select * from t6;
 
9546
alter table t11
 
9547
partition by range(quarter(col1)) 
 
9548
(partition p0 values less than (15),
 
9549
partition p1 values less than maxvalue);
 
9550
alter table t22
 
9551
partition by list(quarter(col1)) 
 
9552
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
9553
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
9554
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
9555
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
9556
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
9557
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
9558
);
 
9559
alter table t33
 
9560
partition by hash(quarter(col1));
 
9561
alter table t44
 
9562
partition by range(colint) 
 
9563
subpartition by hash(quarter(col1)) subpartitions 2 
 
9564
(partition p0 values less than (15),
 
9565
partition p1 values less than maxvalue);
 
9566
alter table t55
 
9567
partition by list(colint)
 
9568
subpartition by hash(quarter(col1)) subpartitions 2 
 
9569
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
9570
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
9571
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
9572
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
9573
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
9574
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
9575
);
 
9576
alter table t66
 
9577
partition by range(colint) 
 
9578
(partition p0 values less than (quarter('2006-10-14')),
 
9579
partition p1 values less than maxvalue);
 
9580
select * from t11 order by col1;
 
9581
col1
 
9582
2006-07-30
 
9583
2006-12-17
 
9584
select * from t22 order by col1;
 
9585
col1
 
9586
2006-07-30
 
9587
2006-09-25
 
9588
2006-12-17
 
9589
select * from t33 order by col1;
 
9590
col1
 
9591
2006-07-30
 
9592
2006-09-25
 
9593
2006-12-17
 
9594
select * from t44 order by colint;
 
9595
colint  col1
 
9596
1       2006-02-03
 
9597
2       2006-01-17
 
9598
3       2006-01-25
 
9599
4       2006-02-05
 
9600
select * from t55 order by colint;
 
9601
colint  col1
 
9602
1       2006-02-03
 
9603
2       2006-01-17
 
9604
3       2006-01-25
 
9605
4       2006-02-05
 
9606
select * from t66 order by colint;
 
9607
colint  col1
 
9608
1       2006-02-03
 
9609
2       2006-01-17
 
9610
3       2006-01-25
 
9611
4       2006-02-05
 
9612
---------------------------
 
9613
---- some alter table begin
 
9614
---------------------------
 
9615
alter table t11
 
9616
reorganize partition p0,p1 into
 
9617
(partition s1 values less than maxvalue);
 
9618
select * from t11 order by col1;
 
9619
col1
 
9620
2006-07-30
 
9621
2006-12-17
 
9622
alter table t11
 
9623
reorganize partition s1 into
 
9624
(partition p0 values less than (15),
 
9625
partition p1 values less than maxvalue);
 
9626
select * from t11 order by col1;
 
9627
col1
 
9628
2006-07-30
 
9629
2006-12-17
 
9630
alter table t55
 
9631
partition by list(colint)
 
9632
subpartition by hash(quarter(col1)) subpartitions 5 
 
9633
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
9634
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
9635
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
9636
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
9637
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
9638
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
9639
);
 
9640
show create table t55;
 
9641
Table   Create Table
 
9642
t55     CREATE TABLE `t55` (
 
9643
  `colint` int(11) DEFAULT NULL,
 
9644
  `col1` date DEFAULT NULL
 
9645
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (quarter(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
 
9646
select * from t55 order by colint;
 
9647
colint  col1
 
9648
1       2006-02-03
 
9649
2       2006-01-17
 
9650
3       2006-01-25
 
9651
4       2006-02-05
 
9652
alter table t66
 
9653
reorganize partition p0,p1 into
 
9654
(partition s1 values less than maxvalue);
 
9655
select * from t66 order by colint;
 
9656
colint  col1
 
9657
1       2006-02-03
 
9658
2       2006-01-17
 
9659
3       2006-01-25
 
9660
4       2006-02-05
 
9661
alter table t66
 
9662
reorganize partition s1 into
 
9663
(partition p0 values less than (quarter('2006-10-14')),
 
9664
partition p1 values less than maxvalue);
 
9665
select * from t66 order by colint;
 
9666
colint  col1
 
9667
1       2006-02-03
 
9668
2       2006-01-17
 
9669
3       2006-01-25
 
9670
4       2006-02-05
 
9671
alter table t66
 
9672
reorganize partition p0,p1 into
 
9673
(partition s1 values less than maxvalue);
 
9674
select * from t66 order by colint;
 
9675
colint  col1
 
9676
1       2006-02-03
 
9677
2       2006-01-17
 
9678
3       2006-01-25
 
9679
4       2006-02-05
 
9680
alter table t66
 
9681
reorganize partition s1 into
 
9682
(partition p0 values less than (quarter('2006-10-14')),
 
9683
partition p1 values less than maxvalue);
 
9684
select * from t66 order by colint;
 
9685
colint  col1
 
9686
1       2006-02-03
 
9687
2       2006-01-17
 
9688
3       2006-01-25
 
9689
4       2006-02-05
 
9690
-------------------------------------------------------------------------
 
9691
---  Delete rows and partitions of tables with quarter(col1)
 
9692
-------------------------------------------------------------------------
 
9693
delete from t1 where col1='2006-12-17';
 
9694
delete from t2 where col1='2006-12-17';
 
9695
delete from t3 where col1='2006-12-17';
 
9696
delete from t4 where col1='2006-12-17';
 
9697
delete from t5 where col1='2006-12-17';
 
9698
delete from t6 where col1='2006-12-17';
 
9699
select * from t1 order by col1;
 
9700
col1
 
9701
2006-07-30
 
9702
select * from t2 order by col1;
 
9703
col1
 
9704
2006-07-30
 
9705
2006-09-25
 
9706
select * from t3 order by col1;
 
9707
col1
 
9708
2006-07-30
 
9709
2006-09-25
 
9710
select * from t4 order by colint;
 
9711
colint  col1
 
9712
1       2006-02-03
 
9713
2       2006-01-17
 
9714
3       2006-01-25
 
9715
4       2006-02-05
 
9716
select * from t5 order by colint;
 
9717
colint  col1
 
9718
1       2006-02-03
 
9719
2       2006-01-17
 
9720
3       2006-01-25
 
9721
4       2006-02-05
 
9722
insert into t1 values ('2006-12-17');
 
9723
insert into t2 values ('2006-12-17');
 
9724
insert into t3 values ('2006-12-17');
 
9725
insert into t4 values (60,'2006-12-17');
 
9726
insert into t5 values (60,'2006-12-17');
 
9727
insert into t6 values (60,'2006-12-17');
 
9728
select * from t1 order by col1;
 
9729
col1
 
9730
2006-07-30
 
9731
2006-12-17
 
9732
select * from t2 order by col1;
 
9733
col1
 
9734
2006-07-30
 
9735
2006-09-25
 
9736
2006-12-17
 
9737
select * from t3 order by col1;
 
9738
col1
 
9739
2006-07-30
 
9740
2006-09-25
 
9741
2006-12-17
 
9742
select * from t4 order by colint;
 
9743
colint  col1
 
9744
1       2006-02-03
 
9745
2       2006-01-17
 
9746
3       2006-01-25
 
9747
4       2006-02-05
 
9748
60      2006-12-17
 
9749
select * from t5 order by colint;
 
9750
colint  col1
 
9751
1       2006-02-03
 
9752
2       2006-01-17
 
9753
3       2006-01-25
 
9754
4       2006-02-05
 
9755
60      2006-12-17
 
9756
select * from t6 order by colint;
 
9757
colint  col1
 
9758
1       2006-02-03
 
9759
2       2006-01-17
 
9760
3       2006-01-25
 
9761
4       2006-02-05
 
9762
60      2006-12-17
 
9763
alter table t1 drop partition p0;
 
9764
alter table t2 drop partition p0;
 
9765
alter table t4 drop partition p0;
 
9766
alter table t5 drop partition p0;
 
9767
alter table t6 drop partition p0;
 
9768
select * from t1 order by col1;
 
9769
col1
 
9770
select * from t2 order by col1;
 
9771
col1
 
9772
select * from t3 order by col1;
 
9773
col1
 
9774
2006-07-30
 
9775
2006-09-25
 
9776
2006-12-17
 
9777
select * from t4 order by colint;
 
9778
colint  col1
 
9779
60      2006-12-17
 
9780
select * from t5 order by colint;
 
9781
colint  col1
 
9782
60      2006-12-17
 
9783
select * from t6 order by colint;
 
9784
colint  col1
 
9785
4       2006-02-05
 
9786
60      2006-12-17
 
9787
-------------------------------------------------------------------------
 
9788
---  Delete rows and partitions of tables with quarter(col1)
 
9789
-------------------------------------------------------------------------
 
9790
delete from t11 where col1='2006-12-17';
 
9791
delete from t22 where col1='2006-12-17';
 
9792
delete from t33 where col1='2006-12-17';
 
9793
delete from t44 where col1='2006-12-17';
 
9794
delete from t55 where col1='2006-12-17';
 
9795
delete from t66 where col1='2006-12-17';
 
9796
select * from t11 order by col1;
 
9797
col1
 
9798
2006-07-30
 
9799
select * from t22 order by col1;
 
9800
col1
 
9801
2006-07-30
 
9802
2006-09-25
 
9803
select * from t33 order by col1;
 
9804
col1
 
9805
2006-07-30
 
9806
2006-09-25
 
9807
select * from t44 order by colint;
 
9808
colint  col1
 
9809
1       2006-02-03
 
9810
2       2006-01-17
 
9811
3       2006-01-25
 
9812
4       2006-02-05
 
9813
select * from t55 order by colint;
 
9814
colint  col1
 
9815
1       2006-02-03
 
9816
2       2006-01-17
 
9817
3       2006-01-25
 
9818
4       2006-02-05
 
9819
insert into t11 values ('2006-12-17');
 
9820
insert into t22 values ('2006-12-17');
 
9821
insert into t33 values ('2006-12-17');
 
9822
insert into t44 values (60,'2006-12-17');
 
9823
insert into t55 values (60,'2006-12-17');
 
9824
insert into t66 values (60,'2006-12-17');
 
9825
select * from t11 order by col1;
 
9826
col1
 
9827
2006-07-30
 
9828
2006-12-17
 
9829
select * from t22 order by col1;
 
9830
col1
 
9831
2006-07-30
 
9832
2006-09-25
 
9833
2006-12-17
 
9834
select * from t33 order by col1;
 
9835
col1
 
9836
2006-07-30
 
9837
2006-09-25
 
9838
2006-12-17
 
9839
select * from t44 order by colint;
 
9840
colint  col1
 
9841
1       2006-02-03
 
9842
2       2006-01-17
 
9843
3       2006-01-25
 
9844
4       2006-02-05
 
9845
60      2006-12-17
 
9846
select * from t55 order by colint;
 
9847
colint  col1
 
9848
1       2006-02-03
 
9849
2       2006-01-17
 
9850
3       2006-01-25
 
9851
4       2006-02-05
 
9852
60      2006-12-17
 
9853
select * from t66 order by colint;
 
9854
colint  col1
 
9855
1       2006-02-03
 
9856
2       2006-01-17
 
9857
3       2006-01-25
 
9858
4       2006-02-05
 
9859
60      2006-12-17
 
9860
alter table t11 drop partition p0;
 
9861
alter table t22 drop partition p0;
 
9862
alter table t44 drop partition p0;
 
9863
alter table t55 drop partition p0;
 
9864
alter table t66 drop partition p0;
 
9865
select * from t11 order by col1;
 
9866
col1
 
9867
select * from t22 order by col1;
 
9868
col1
 
9869
select * from t33 order by col1;
 
9870
col1
 
9871
2006-07-30
 
9872
2006-09-25
 
9873
2006-12-17
 
9874
select * from t44 order by colint;
 
9875
colint  col1
 
9876
60      2006-12-17
 
9877
select * from t55 order by colint;
 
9878
colint  col1
 
9879
60      2006-12-17
 
9880
select * from t66 order by colint;
 
9881
colint  col1
 
9882
4       2006-02-05
 
9883
60      2006-12-17
 
9884
-------------------------
 
9885
---- some alter table end
 
9886
-------------------------
 
9887
drop table if exists t1 ;
 
9888
drop table if exists t2 ;
 
9889
drop table if exists t3 ;
 
9890
drop table if exists t4 ;
 
9891
drop table if exists t5 ;
 
9892
drop table if exists t6 ;
 
9893
drop table if exists t11 ;
 
9894
drop table if exists t22 ;
 
9895
drop table if exists t33 ;
 
9896
drop table if exists t44 ;
 
9897
drop table if exists t55 ;
 
9898
drop table if exists t66 ;
 
9899
-------------------------------------------------------------------------
 
9900
---  time_to_sec(col1)-(time_to_sec(col1)-20)  in partition with coltype  time
 
9901
-------------------------------------------------------------------------
 
9902
drop table if exists t1 ;
 
9903
drop table if exists t2 ;
 
9904
drop table if exists t3 ;
 
9905
drop table if exists t4 ;
 
9906
drop table if exists t5 ;
 
9907
drop table if exists t6 ;
 
9908
-------------------------------------------------------------------------
 
9909
---  Create tables with time_to_sec(col1)-(time_to_sec(col1)-20)
 
9910
-------------------------------------------------------------------------
 
9911
create table t1 (col1 time) engine='MYISAM' 
 
9912
partition by range(time_to_sec(col1)-(time_to_sec(col1)-20)) 
 
9913
(partition p0 values less than (15),
 
9914
partition p1 values less than maxvalue);
 
9915
create table t2 (col1 time) engine='MYISAM' 
 
9916
partition by list(time_to_sec(col1)-(time_to_sec(col1)-20)) 
 
9917
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
9918
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
9919
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
9920
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
9921
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
9922
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
9923
);
 
9924
create table t3 (col1 time) engine='MYISAM' 
 
9925
partition by hash(time_to_sec(col1)-(time_to_sec(col1)-20));
 
9926
create table t4 (colint int, col1 time) engine='MYISAM' 
 
9927
partition by range(colint) 
 
9928
subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2 
 
9929
(partition p0 values less than (15),
 
9930
partition p1 values less than maxvalue);
 
9931
create table t5 (colint int, col1 time) engine='MYISAM' 
 
9932
partition by list(colint)
 
9933
subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2 
 
9934
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
9935
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
9936
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
9937
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
9938
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
9939
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
9940
);
 
9941
create table t6 (colint int, col1 time) engine='MYISAM' 
 
9942
partition by range(colint) 
 
9943
(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
 
9944
partition p1 values less than maxvalue);
 
9945
-------------------------------------------------------------------------
 
9946
---  Access tables with time_to_sec(col1)-(time_to_sec(col1)-20) 
 
9947
-------------------------------------------------------------------------
 
9948
insert into t1 values ('09:09:15');
 
9949
insert into t1 values ('14:30:45');
 
9950
insert into t2 values ('09:09:15');
 
9951
insert into t2 values ('14:30:45');
 
9952
insert into t2 values ('21:59:22');
 
9953
insert into t3 values ('09:09:15');
 
9954
insert into t3 values ('14:30:45');
 
9955
insert into t3 values ('21:59:22');
 
9956
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4;
 
9957
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5;
 
9958
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6;
 
9959
select time_to_sec(col1)-(time_to_sec(col1)-20) from t1 order by col1;
 
9960
time_to_sec(col1)-(time_to_sec(col1)-20)
 
9961
20
 
9962
20
 
9963
select * from t1 order by col1;
 
9964
col1
 
9965
09:09:15
 
9966
14:30:45
 
9967
select * from t2 order by col1;
 
9968
col1
 
9969
09:09:15
 
9970
14:30:45
 
9971
21:59:22
 
9972
select * from t3 order by col1;
 
9973
col1
 
9974
09:09:15
 
9975
14:30:45
 
9976
21:59:22
 
9977
select * from t4 order by colint;
 
9978
colint  col1
 
9979
1       09:09:15
 
9980
2       04:30:01
 
9981
3       00:59:22
 
9982
4       05:30:34
 
9983
select * from t5 order by colint;
 
9984
colint  col1
 
9985
1       09:09:15
 
9986
2       04:30:01
 
9987
3       00:59:22
 
9988
4       05:30:34
 
9989
select * from t6 order by colint;
 
9990
colint  col1
 
9991
1       09:09:15
 
9992
2       04:30:01
 
9993
3       00:59:22
 
9994
4       05:30:34
 
9995
update t1 set col1='10:33:11' where col1='09:09:15';
 
9996
update t2 set col1='10:33:11' where col1='09:09:15';
 
9997
update t3 set col1='10:33:11' where col1='09:09:15';
 
9998
update t4 set col1='10:33:11' where col1='09:09:15';
 
9999
update t5 set col1='10:33:11' where col1='09:09:15';
 
10000
update t6 set col1='10:33:11' where col1='09:09:15';
 
10001
select * from t1 order by col1;
 
10002
col1
 
10003
10:33:11
 
10004
14:30:45
 
10005
select * from t2 order by col1;
 
10006
col1
 
10007
10:33:11
 
10008
14:30:45
 
10009
21:59:22
 
10010
select * from t3 order by col1;
 
10011
col1
 
10012
10:33:11
 
10013
14:30:45
 
10014
21:59:22
 
10015
select * from t4 order by colint;
 
10016
colint  col1
 
10017
1       10:33:11
 
10018
2       04:30:01
 
10019
3       00:59:22
 
10020
4       05:30:34
 
10021
select * from t5 order by colint;
 
10022
colint  col1
 
10023
1       10:33:11
 
10024
2       04:30:01
 
10025
3       00:59:22
 
10026
4       05:30:34
 
10027
select * from t6 order by colint;
 
10028
colint  col1
 
10029
1       10:33:11
 
10030
2       04:30:01
 
10031
3       00:59:22
 
10032
4       05:30:34
 
10033
-------------------------------------------------------------------------
 
10034
---  Alter tables with time_to_sec(col1)-(time_to_sec(col1)-20)
 
10035
-------------------------------------------------------------------------
 
10036
drop table if exists t11 ;
 
10037
drop table if exists t22 ;
 
10038
drop table if exists t33 ;
 
10039
drop table if exists t44 ;
 
10040
drop table if exists t55 ;
 
10041
drop table if exists t66 ;
 
10042
create table t11 engine='MYISAM' as select * from t1;
 
10043
create table t22 engine='MYISAM' as select * from t2;
 
10044
create table t33 engine='MYISAM' as select * from t3;
 
10045
create table t44 engine='MYISAM' as select * from t4;
 
10046
create table t55 engine='MYISAM' as select * from t5;
 
10047
create table t66 engine='MYISAM' as select * from t6;
 
10048
alter table t11
 
10049
partition by range(time_to_sec(col1)-(time_to_sec(col1)-20)) 
 
10050
(partition p0 values less than (15),
 
10051
partition p1 values less than maxvalue);
 
10052
alter table t22
 
10053
partition by list(time_to_sec(col1)-(time_to_sec(col1)-20)) 
 
10054
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
10055
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
10056
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
10057
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
10058
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
10059
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
10060
);
 
10061
alter table t33
 
10062
partition by hash(time_to_sec(col1)-(time_to_sec(col1)-20));
 
10063
alter table t44
 
10064
partition by range(colint) 
 
10065
subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2 
 
10066
(partition p0 values less than (15),
 
10067
partition p1 values less than maxvalue);
 
10068
alter table t55
 
10069
partition by list(colint)
 
10070
subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2 
 
10071
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
10072
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
10073
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
10074
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
10075
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
10076
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
10077
);
 
10078
alter table t66
 
10079
partition by range(colint) 
 
10080
(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
 
10081
partition p1 values less than maxvalue);
 
10082
select * from t11 order by col1;
 
10083
col1
 
10084
10:33:11
 
10085
14:30:45
 
10086
select * from t22 order by col1;
 
10087
col1
 
10088
10:33:11
 
10089
14:30:45
 
10090
21:59:22
 
10091
select * from t33 order by col1;
 
10092
col1
 
10093
10:33:11
 
10094
14:30:45
 
10095
21:59:22
 
10096
select * from t44 order by colint;
 
10097
colint  col1
 
10098
1       10:33:11
 
10099
2       04:30:01
 
10100
3       00:59:22
 
10101
4       05:30:34
 
10102
select * from t55 order by colint;
 
10103
colint  col1
 
10104
1       10:33:11
 
10105
2       04:30:01
 
10106
3       00:59:22
 
10107
4       05:30:34
 
10108
select * from t66 order by colint;
 
10109
colint  col1
 
10110
1       10:33:11
 
10111
2       04:30:01
 
10112
3       00:59:22
 
10113
4       05:30:34
 
10114
---------------------------
 
10115
---- some alter table begin
 
10116
---------------------------
 
10117
alter table t11
 
10118
reorganize partition p0,p1 into
 
10119
(partition s1 values less than maxvalue);
 
10120
select * from t11 order by col1;
 
10121
col1
 
10122
10:33:11
 
10123
14:30:45
 
10124
alter table t11
 
10125
reorganize partition s1 into
 
10126
(partition p0 values less than (15),
 
10127
partition p1 values less than maxvalue);
 
10128
select * from t11 order by col1;
 
10129
col1
 
10130
10:33:11
 
10131
14:30:45
 
10132
alter table t55
 
10133
partition by list(colint)
 
10134
subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 5 
 
10135
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
10136
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
10137
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
10138
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
10139
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
10140
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
10141
);
 
10142
show create table t55;
 
10143
Table   Create Table
 
10144
t55     CREATE TABLE `t55` (
 
10145
  `colint` int(11) DEFAULT NULL,
 
10146
  `col1` time DEFAULT NULL
 
10147
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (time_to_sec(col1)-(time_to_sec(col1)-20)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
 
10148
select * from t55 order by colint;
 
10149
colint  col1
 
10150
1       10:33:11
 
10151
2       04:30:01
 
10152
3       00:59:22
 
10153
4       05:30:34
 
10154
alter table t66
 
10155
reorganize partition p0,p1 into
 
10156
(partition s1 values less than maxvalue);
 
10157
select * from t66 order by colint;
 
10158
colint  col1
 
10159
1       10:33:11
 
10160
2       04:30:01
 
10161
3       00:59:22
 
10162
4       05:30:34
 
10163
alter table t66
 
10164
reorganize partition s1 into
 
10165
(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
 
10166
partition p1 values less than maxvalue);
 
10167
select * from t66 order by colint;
 
10168
colint  col1
 
10169
1       10:33:11
 
10170
2       04:30:01
 
10171
3       00:59:22
 
10172
4       05:30:34
 
10173
alter table t66
 
10174
reorganize partition p0,p1 into
 
10175
(partition s1 values less than maxvalue);
 
10176
select * from t66 order by colint;
 
10177
colint  col1
 
10178
1       10:33:11
 
10179
2       04:30:01
 
10180
3       00:59:22
 
10181
4       05:30:34
 
10182
alter table t66
 
10183
reorganize partition s1 into
 
10184
(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
 
10185
partition p1 values less than maxvalue);
 
10186
select * from t66 order by colint;
 
10187
colint  col1
 
10188
1       10:33:11
 
10189
2       04:30:01
 
10190
3       00:59:22
 
10191
4       05:30:34
 
10192
-------------------------------------------------------------------------
 
10193
---  Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20)
 
10194
-------------------------------------------------------------------------
 
10195
delete from t1 where col1='14:30:45';
 
10196
delete from t2 where col1='14:30:45';
 
10197
delete from t3 where col1='14:30:45';
 
10198
delete from t4 where col1='14:30:45';
 
10199
delete from t5 where col1='14:30:45';
 
10200
delete from t6 where col1='14:30:45';
 
10201
select * from t1 order by col1;
 
10202
col1
 
10203
10:33:11
 
10204
select * from t2 order by col1;
 
10205
col1
 
10206
10:33:11
 
10207
21:59:22
 
10208
select * from t3 order by col1;
 
10209
col1
 
10210
10:33:11
 
10211
21:59:22
 
10212
select * from t4 order by colint;
 
10213
colint  col1
 
10214
1       10:33:11
 
10215
2       04:30:01
 
10216
3       00:59:22
 
10217
4       05:30:34
 
10218
select * from t5 order by colint;
 
10219
colint  col1
 
10220
1       10:33:11
 
10221
2       04:30:01
 
10222
3       00:59:22
 
10223
4       05:30:34
 
10224
insert into t1 values ('14:30:45');
 
10225
insert into t2 values ('14:30:45');
 
10226
insert into t3 values ('14:30:45');
 
10227
insert into t4 values (60,'14:30:45');
 
10228
insert into t5 values (60,'14:30:45');
 
10229
insert into t6 values (60,'14:30:45');
 
10230
select * from t1 order by col1;
 
10231
col1
 
10232
10:33:11
 
10233
14:30:45
 
10234
select * from t2 order by col1;
 
10235
col1
 
10236
10:33:11
 
10237
14:30:45
 
10238
21:59:22
 
10239
select * from t3 order by col1;
 
10240
col1
 
10241
10:33:11
 
10242
14:30:45
 
10243
21:59:22
 
10244
select * from t4 order by colint;
 
10245
colint  col1
 
10246
1       10:33:11
 
10247
2       04:30:01
 
10248
3       00:59:22
 
10249
4       05:30:34
 
10250
60      14:30:45
 
10251
select * from t5 order by colint;
 
10252
colint  col1
 
10253
1       10:33:11
 
10254
2       04:30:01
 
10255
3       00:59:22
 
10256
4       05:30:34
 
10257
60      14:30:45
 
10258
select * from t6 order by colint;
 
10259
colint  col1
 
10260
1       10:33:11
 
10261
2       04:30:01
 
10262
3       00:59:22
 
10263
4       05:30:34
 
10264
60      14:30:45
 
10265
alter table t1 drop partition p0;
 
10266
alter table t2 drop partition p0;
 
10267
alter table t4 drop partition p0;
 
10268
alter table t5 drop partition p0;
 
10269
alter table t6 drop partition p0;
 
10270
select * from t1 order by col1;
 
10271
col1
 
10272
10:33:11
 
10273
14:30:45
 
10274
select * from t2 order by col1;
 
10275
col1
 
10276
10:33:11
 
10277
14:30:45
 
10278
21:59:22
 
10279
select * from t3 order by col1;
 
10280
col1
 
10281
10:33:11
 
10282
14:30:45
 
10283
21:59:22
 
10284
select * from t4 order by colint;
 
10285
colint  col1
 
10286
60      14:30:45
 
10287
select * from t5 order by colint;
 
10288
colint  col1
 
10289
60      14:30:45
 
10290
select * from t6 order by colint;
 
10291
colint  col1
 
10292
-------------------------------------------------------------------------
 
10293
---  Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20)
 
10294
-------------------------------------------------------------------------
 
10295
delete from t11 where col1='14:30:45';
 
10296
delete from t22 where col1='14:30:45';
 
10297
delete from t33 where col1='14:30:45';
 
10298
delete from t44 where col1='14:30:45';
 
10299
delete from t55 where col1='14:30:45';
 
10300
delete from t66 where col1='14:30:45';
 
10301
select * from t11 order by col1;
 
10302
col1
 
10303
10:33:11
 
10304
select * from t22 order by col1;
 
10305
col1
 
10306
10:33:11
 
10307
21:59:22
 
10308
select * from t33 order by col1;
 
10309
col1
 
10310
10:33:11
 
10311
21:59:22
 
10312
select * from t44 order by colint;
 
10313
colint  col1
 
10314
1       10:33:11
 
10315
2       04:30:01
 
10316
3       00:59:22
 
10317
4       05:30:34
 
10318
select * from t55 order by colint;
 
10319
colint  col1
 
10320
1       10:33:11
 
10321
2       04:30:01
 
10322
3       00:59:22
 
10323
4       05:30:34
 
10324
insert into t11 values ('14:30:45');
 
10325
insert into t22 values ('14:30:45');
 
10326
insert into t33 values ('14:30:45');
 
10327
insert into t44 values (60,'14:30:45');
 
10328
insert into t55 values (60,'14:30:45');
 
10329
insert into t66 values (60,'14:30:45');
 
10330
select * from t11 order by col1;
 
10331
col1
 
10332
10:33:11
 
10333
14:30:45
 
10334
select * from t22 order by col1;
 
10335
col1
 
10336
10:33:11
 
10337
14:30:45
 
10338
21:59:22
 
10339
select * from t33 order by col1;
 
10340
col1
 
10341
10:33:11
 
10342
14:30:45
 
10343
21:59:22
 
10344
select * from t44 order by colint;
 
10345
colint  col1
 
10346
1       10:33:11
 
10347
2       04:30:01
 
10348
3       00:59:22
 
10349
4       05:30:34
 
10350
60      14:30:45
 
10351
select * from t55 order by colint;
 
10352
colint  col1
 
10353
1       10:33:11
 
10354
2       04:30:01
 
10355
3       00:59:22
 
10356
4       05:30:34
 
10357
60      14:30:45
 
10358
select * from t66 order by colint;
 
10359
colint  col1
 
10360
1       10:33:11
 
10361
2       04:30:01
 
10362
3       00:59:22
 
10363
4       05:30:34
 
10364
60      14:30:45
 
10365
alter table t11 drop partition p0;
 
10366
alter table t22 drop partition p0;
 
10367
alter table t44 drop partition p0;
 
10368
alter table t55 drop partition p0;
 
10369
alter table t66 drop partition p0;
 
10370
select * from t11 order by col1;
 
10371
col1
 
10372
10:33:11
 
10373
14:30:45
 
10374
select * from t22 order by col1;
 
10375
col1
 
10376
10:33:11
 
10377
14:30:45
 
10378
21:59:22
 
10379
select * from t33 order by col1;
 
10380
col1
 
10381
10:33:11
 
10382
14:30:45
 
10383
21:59:22
 
10384
select * from t44 order by colint;
 
10385
colint  col1
 
10386
60      14:30:45
 
10387
select * from t55 order by colint;
 
10388
colint  col1
 
10389
60      14:30:45
 
10390
select * from t66 order by colint;
 
10391
colint  col1
 
10392
-------------------------
 
10393
---- some alter table end
 
10394
-------------------------
 
10395
drop table if exists t1 ;
 
10396
drop table if exists t2 ;
 
10397
drop table if exists t3 ;
 
10398
drop table if exists t4 ;
 
10399
drop table if exists t5 ;
 
10400
drop table if exists t6 ;
 
10401
drop table if exists t11 ;
 
10402
drop table if exists t22 ;
 
10403
drop table if exists t33 ;
 
10404
drop table if exists t44 ;
 
10405
drop table if exists t55 ;
 
10406
drop table if exists t66 ;
 
10407
-------------------------------------------------------------------------
 
10408
---  to_days(col1)-to_days('2006-01-01')  in partition with coltype  date
 
10409
-------------------------------------------------------------------------
 
10410
drop table if exists t1 ;
 
10411
drop table if exists t2 ;
 
10412
drop table if exists t3 ;
 
10413
drop table if exists t4 ;
 
10414
drop table if exists t5 ;
 
10415
drop table if exists t6 ;
 
10416
-------------------------------------------------------------------------
 
10417
---  Create tables with to_days(col1)-to_days('2006-01-01')
 
10418
-------------------------------------------------------------------------
 
10419
create table t1 (col1 date) engine='MYISAM' 
 
10420
partition by range(to_days(col1)-to_days('2006-01-01')) 
 
10421
(partition p0 values less than (15),
 
10422
partition p1 values less than maxvalue);
 
10423
create table t2 (col1 date) engine='MYISAM' 
 
10424
partition by list(to_days(col1)-to_days('2006-01-01')) 
 
10425
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
10426
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
10427
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
10428
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
10429
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
10430
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
10431
);
 
10432
create table t3 (col1 date) engine='MYISAM' 
 
10433
partition by hash(to_days(col1)-to_days('2006-01-01'));
 
10434
create table t4 (colint int, col1 date) engine='MYISAM' 
 
10435
partition by range(colint) 
 
10436
subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 
 
10437
(partition p0 values less than (15),
 
10438
partition p1 values less than maxvalue);
 
10439
create table t5 (colint int, col1 date) engine='MYISAM' 
 
10440
partition by list(colint)
 
10441
subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 
 
10442
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
10443
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
10444
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
10445
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
10446
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
10447
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
10448
);
 
10449
create table t6 (colint int, col1 date) engine='MYISAM' 
 
10450
partition by range(colint) 
 
10451
(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
 
10452
partition p1 values less than maxvalue);
 
10453
-------------------------------------------------------------------------
 
10454
---  Access tables with to_days(col1)-to_days('2006-01-01') 
 
10455
-------------------------------------------------------------------------
 
10456
insert into t1 values ('2006-02-03');
 
10457
insert into t1 values ('2006-01-17');
 
10458
insert into t2 values ('2006-02-03');
 
10459
insert into t2 values ('2006-01-17');
 
10460
insert into t2 values ('2006-01-25');
 
10461
insert into t3 values ('2006-02-03');
 
10462
insert into t3 values ('2006-01-17');
 
10463
insert into t3 values ('2006-01-25');
 
10464
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
 
10465
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
 
10466
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
 
10467
select to_days(col1)-to_days('2006-01-01') from t1 order by col1;
 
10468
to_days(col1)-to_days('2006-01-01')
 
10469
16
 
10470
33
 
10471
select * from t1 order by col1;
 
10472
col1
 
10473
2006-01-17
 
10474
2006-02-03
 
10475
select * from t2 order by col1;
 
10476
col1
 
10477
2006-01-17
 
10478
2006-01-25
 
10479
2006-02-03
 
10480
select * from t3 order by col1;
 
10481
col1
 
10482
2006-01-17
 
10483
2006-01-25
 
10484
2006-02-03
 
10485
select * from t4 order by colint;
 
10486
colint  col1
 
10487
1       2006-02-03
 
10488
2       2006-01-17
 
10489
3       2006-01-25
 
10490
4       2006-02-05
 
10491
select * from t5 order by colint;
 
10492
colint  col1
 
10493
1       2006-02-03
 
10494
2       2006-01-17
 
10495
3       2006-01-25
 
10496
4       2006-02-05
 
10497
select * from t6 order by colint;
 
10498
colint  col1
 
10499
1       2006-02-03
 
10500
2       2006-01-17
 
10501
3       2006-01-25
 
10502
4       2006-02-05
 
10503
update t1 set col1='2006-02-06' where col1='2006-02-03';
 
10504
update t2 set col1='2006-02-06' where col1='2006-02-03';
 
10505
update t3 set col1='2006-02-06' where col1='2006-02-03';
 
10506
update t4 set col1='2006-02-06' where col1='2006-02-03';
 
10507
update t5 set col1='2006-02-06' where col1='2006-02-03';
 
10508
update t6 set col1='2006-02-06' where col1='2006-02-03';
 
10509
select * from t1 order by col1;
 
10510
col1
 
10511
2006-01-17
 
10512
2006-02-06
 
10513
select * from t2 order by col1;
 
10514
col1
 
10515
2006-01-17
 
10516
2006-01-25
 
10517
2006-02-06
 
10518
select * from t3 order by col1;
 
10519
col1
 
10520
2006-01-17
 
10521
2006-01-25
 
10522
2006-02-06
 
10523
select * from t4 order by colint;
 
10524
colint  col1
 
10525
1       2006-02-06
 
10526
2       2006-01-17
 
10527
3       2006-01-25
 
10528
4       2006-02-05
 
10529
select * from t5 order by colint;
 
10530
colint  col1
 
10531
1       2006-02-06
 
10532
2       2006-01-17
 
10533
3       2006-01-25
 
10534
4       2006-02-05
 
10535
select * from t6 order by colint;
 
10536
colint  col1
 
10537
1       2006-02-06
 
10538
2       2006-01-17
 
10539
3       2006-01-25
 
10540
4       2006-02-05
 
10541
-------------------------------------------------------------------------
 
10542
---  Alter tables with to_days(col1)-to_days('2006-01-01')
 
10543
-------------------------------------------------------------------------
 
10544
drop table if exists t11 ;
 
10545
drop table if exists t22 ;
 
10546
drop table if exists t33 ;
 
10547
drop table if exists t44 ;
 
10548
drop table if exists t55 ;
 
10549
drop table if exists t66 ;
 
10550
create table t11 engine='MYISAM' as select * from t1;
 
10551
create table t22 engine='MYISAM' as select * from t2;
 
10552
create table t33 engine='MYISAM' as select * from t3;
 
10553
create table t44 engine='MYISAM' as select * from t4;
 
10554
create table t55 engine='MYISAM' as select * from t5;
 
10555
create table t66 engine='MYISAM' as select * from t6;
 
10556
alter table t11
 
10557
partition by range(to_days(col1)-to_days('2006-01-01')) 
 
10558
(partition p0 values less than (15),
 
10559
partition p1 values less than maxvalue);
 
10560
alter table t22
 
10561
partition by list(to_days(col1)-to_days('2006-01-01')) 
 
10562
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
10563
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
10564
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
10565
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
10566
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
10567
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
10568
);
 
10569
alter table t33
 
10570
partition by hash(to_days(col1)-to_days('2006-01-01'));
 
10571
alter table t44
 
10572
partition by range(colint) 
 
10573
subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 
 
10574
(partition p0 values less than (15),
 
10575
partition p1 values less than maxvalue);
 
10576
alter table t55
 
10577
partition by list(colint)
 
10578
subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 
 
10579
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
10580
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
10581
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
10582
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
10583
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
10584
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
10585
);
 
10586
alter table t66
 
10587
partition by range(colint) 
 
10588
(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
 
10589
partition p1 values less than maxvalue);
 
10590
select * from t11 order by col1;
 
10591
col1
 
10592
2006-01-17
 
10593
2006-02-06
 
10594
select * from t22 order by col1;
 
10595
col1
 
10596
2006-01-17
 
10597
2006-01-25
 
10598
2006-02-06
 
10599
select * from t33 order by col1;
 
10600
col1
 
10601
2006-01-17
 
10602
2006-01-25
 
10603
2006-02-06
 
10604
select * from t44 order by colint;
 
10605
colint  col1
 
10606
1       2006-02-06
 
10607
2       2006-01-17
 
10608
3       2006-01-25
 
10609
4       2006-02-05
 
10610
select * from t55 order by colint;
 
10611
colint  col1
 
10612
1       2006-02-06
 
10613
2       2006-01-17
 
10614
3       2006-01-25
 
10615
4       2006-02-05
 
10616
select * from t66 order by colint;
 
10617
colint  col1
 
10618
1       2006-02-06
 
10619
2       2006-01-17
 
10620
3       2006-01-25
 
10621
4       2006-02-05
 
10622
---------------------------
 
10623
---- some alter table begin
 
10624
---------------------------
 
10625
alter table t11
 
10626
reorganize partition p0,p1 into
 
10627
(partition s1 values less than maxvalue);
 
10628
select * from t11 order by col1;
 
10629
col1
 
10630
2006-01-17
 
10631
2006-02-06
 
10632
alter table t11
 
10633
reorganize partition s1 into
 
10634
(partition p0 values less than (15),
 
10635
partition p1 values less than maxvalue);
 
10636
select * from t11 order by col1;
 
10637
col1
 
10638
2006-01-17
 
10639
2006-02-06
 
10640
alter table t55
 
10641
partition by list(colint)
 
10642
subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 5 
 
10643
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
10644
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
10645
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
10646
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
10647
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
10648
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
10649
);
 
10650
show create table t55;
 
10651
Table   Create Table
 
10652
t55     CREATE TABLE `t55` (
 
10653
  `colint` int(11) DEFAULT NULL,
 
10654
  `col1` date DEFAULT NULL
 
10655
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (to_days(col1)-to_days('2006-01-01')) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
 
10656
select * from t55 order by colint;
 
10657
colint  col1
 
10658
1       2006-02-06
 
10659
2       2006-01-17
 
10660
3       2006-01-25
 
10661
4       2006-02-05
 
10662
alter table t66
 
10663
reorganize partition p0,p1 into
 
10664
(partition s1 values less than maxvalue);
 
10665
select * from t66 order by colint;
 
10666
colint  col1
 
10667
1       2006-02-06
 
10668
2       2006-01-17
 
10669
3       2006-01-25
 
10670
4       2006-02-05
 
10671
alter table t66
 
10672
reorganize partition s1 into
 
10673
(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
 
10674
partition p1 values less than maxvalue);
 
10675
select * from t66 order by colint;
 
10676
colint  col1
 
10677
1       2006-02-06
 
10678
2       2006-01-17
 
10679
3       2006-01-25
 
10680
4       2006-02-05
 
10681
alter table t66
 
10682
reorganize partition p0,p1 into
 
10683
(partition s1 values less than maxvalue);
 
10684
select * from t66 order by colint;
 
10685
colint  col1
 
10686
1       2006-02-06
 
10687
2       2006-01-17
 
10688
3       2006-01-25
 
10689
4       2006-02-05
 
10690
alter table t66
 
10691
reorganize partition s1 into
 
10692
(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
 
10693
partition p1 values less than maxvalue);
 
10694
select * from t66 order by colint;
 
10695
colint  col1
 
10696
1       2006-02-06
 
10697
2       2006-01-17
 
10698
3       2006-01-25
 
10699
4       2006-02-05
 
10700
-------------------------------------------------------------------------
 
10701
---  Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01')
 
10702
-------------------------------------------------------------------------
 
10703
delete from t1 where col1='2006-01-17';
 
10704
delete from t2 where col1='2006-01-17';
 
10705
delete from t3 where col1='2006-01-17';
 
10706
delete from t4 where col1='2006-01-17';
 
10707
delete from t5 where col1='2006-01-17';
 
10708
delete from t6 where col1='2006-01-17';
 
10709
select * from t1 order by col1;
 
10710
col1
 
10711
2006-02-06
 
10712
select * from t2 order by col1;
 
10713
col1
 
10714
2006-01-25
 
10715
2006-02-06
 
10716
select * from t3 order by col1;
 
10717
col1
 
10718
2006-01-25
 
10719
2006-02-06
 
10720
select * from t4 order by colint;
 
10721
colint  col1
 
10722
1       2006-02-06
 
10723
3       2006-01-25
 
10724
4       2006-02-05
 
10725
select * from t5 order by colint;
 
10726
colint  col1
 
10727
1       2006-02-06
 
10728
3       2006-01-25
 
10729
4       2006-02-05
 
10730
insert into t1 values ('2006-01-17');
 
10731
insert into t2 values ('2006-01-17');
 
10732
insert into t3 values ('2006-01-17');
 
10733
insert into t4 values (60,'2006-01-17');
 
10734
insert into t5 values (60,'2006-01-17');
 
10735
insert into t6 values (60,'2006-01-17');
 
10736
select * from t1 order by col1;
 
10737
col1
 
10738
2006-01-17
 
10739
2006-02-06
 
10740
select * from t2 order by col1;
 
10741
col1
 
10742
2006-01-17
 
10743
2006-01-25
 
10744
2006-02-06
 
10745
select * from t3 order by col1;
 
10746
col1
 
10747
2006-01-17
 
10748
2006-01-25
 
10749
2006-02-06
 
10750
select * from t4 order by colint;
 
10751
colint  col1
 
10752
1       2006-02-06
 
10753
3       2006-01-25
 
10754
4       2006-02-05
 
10755
60      2006-01-17
 
10756
select * from t5 order by colint;
 
10757
colint  col1
 
10758
1       2006-02-06
 
10759
3       2006-01-25
 
10760
4       2006-02-05
 
10761
60      2006-01-17
 
10762
select * from t6 order by colint;
 
10763
colint  col1
 
10764
1       2006-02-06
 
10765
3       2006-01-25
 
10766
4       2006-02-05
 
10767
60      2006-01-17
 
10768
alter table t1 drop partition p0;
 
10769
alter table t2 drop partition p0;
 
10770
alter table t4 drop partition p0;
 
10771
alter table t5 drop partition p0;
 
10772
alter table t6 drop partition p0;
 
10773
select * from t1 order by col1;
 
10774
col1
 
10775
2006-01-17
 
10776
2006-02-06
 
10777
select * from t2 order by col1;
 
10778
col1
 
10779
2006-01-17
 
10780
2006-01-25
 
10781
2006-02-06
 
10782
select * from t3 order by col1;
 
10783
col1
 
10784
2006-01-17
 
10785
2006-01-25
 
10786
2006-02-06
 
10787
select * from t4 order by colint;
 
10788
colint  col1
 
10789
60      2006-01-17
 
10790
select * from t5 order by colint;
 
10791
colint  col1
 
10792
60      2006-01-17
 
10793
select * from t6 order by colint;
 
10794
colint  col1
 
10795
60      2006-01-17
 
10796
-------------------------------------------------------------------------
 
10797
---  Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01')
 
10798
-------------------------------------------------------------------------
 
10799
delete from t11 where col1='2006-01-17';
 
10800
delete from t22 where col1='2006-01-17';
 
10801
delete from t33 where col1='2006-01-17';
 
10802
delete from t44 where col1='2006-01-17';
 
10803
delete from t55 where col1='2006-01-17';
 
10804
delete from t66 where col1='2006-01-17';
 
10805
select * from t11 order by col1;
 
10806
col1
 
10807
2006-02-06
 
10808
select * from t22 order by col1;
 
10809
col1
 
10810
2006-01-25
 
10811
2006-02-06
 
10812
select * from t33 order by col1;
 
10813
col1
 
10814
2006-01-25
 
10815
2006-02-06
 
10816
select * from t44 order by colint;
 
10817
colint  col1
 
10818
1       2006-02-06
 
10819
3       2006-01-25
 
10820
4       2006-02-05
 
10821
select * from t55 order by colint;
 
10822
colint  col1
 
10823
1       2006-02-06
 
10824
3       2006-01-25
 
10825
4       2006-02-05
 
10826
insert into t11 values ('2006-01-17');
 
10827
insert into t22 values ('2006-01-17');
 
10828
insert into t33 values ('2006-01-17');
 
10829
insert into t44 values (60,'2006-01-17');
 
10830
insert into t55 values (60,'2006-01-17');
 
10831
insert into t66 values (60,'2006-01-17');
 
10832
select * from t11 order by col1;
 
10833
col1
 
10834
2006-01-17
 
10835
2006-02-06
 
10836
select * from t22 order by col1;
 
10837
col1
 
10838
2006-01-17
 
10839
2006-01-25
 
10840
2006-02-06
 
10841
select * from t33 order by col1;
 
10842
col1
 
10843
2006-01-17
 
10844
2006-01-25
 
10845
2006-02-06
 
10846
select * from t44 order by colint;
 
10847
colint  col1
 
10848
1       2006-02-06
 
10849
3       2006-01-25
 
10850
4       2006-02-05
 
10851
60      2006-01-17
 
10852
select * from t55 order by colint;
 
10853
colint  col1
 
10854
1       2006-02-06
 
10855
3       2006-01-25
 
10856
4       2006-02-05
 
10857
60      2006-01-17
 
10858
select * from t66 order by colint;
 
10859
colint  col1
 
10860
1       2006-02-06
 
10861
3       2006-01-25
 
10862
4       2006-02-05
 
10863
60      2006-01-17
 
10864
alter table t11 drop partition p0;
 
10865
alter table t22 drop partition p0;
 
10866
alter table t44 drop partition p0;
 
10867
alter table t55 drop partition p0;
 
10868
alter table t66 drop partition p0;
 
10869
select * from t11 order by col1;
 
10870
col1
 
10871
2006-01-17
 
10872
2006-02-06
 
10873
select * from t22 order by col1;
 
10874
col1
 
10875
2006-01-17
 
10876
2006-01-25
 
10877
2006-02-06
 
10878
select * from t33 order by col1;
 
10879
col1
 
10880
2006-01-17
 
10881
2006-01-25
 
10882
2006-02-06
 
10883
select * from t44 order by colint;
 
10884
colint  col1
 
10885
60      2006-01-17
 
10886
select * from t55 order by colint;
 
10887
colint  col1
 
10888
60      2006-01-17
 
10889
select * from t66 order by colint;
 
10890
colint  col1
 
10891
60      2006-01-17
 
10892
-------------------------
 
10893
---- some alter table end
 
10894
-------------------------
 
10895
drop table if exists t1 ;
 
10896
drop table if exists t2 ;
 
10897
drop table if exists t3 ;
 
10898
drop table if exists t4 ;
 
10899
drop table if exists t5 ;
 
10900
drop table if exists t6 ;
 
10901
drop table if exists t11 ;
 
10902
drop table if exists t22 ;
 
10903
drop table if exists t33 ;
 
10904
drop table if exists t44 ;
 
10905
drop table if exists t55 ;
 
10906
drop table if exists t66 ;
 
10907
-------------------------------------------------------------------------
 
10908
---  datediff(col1, '2006-01-01')  in partition with coltype  date
 
10909
-------------------------------------------------------------------------
 
10910
drop table if exists t1 ;
 
10911
drop table if exists t2 ;
 
10912
drop table if exists t3 ;
 
10913
drop table if exists t4 ;
 
10914
drop table if exists t5 ;
 
10915
drop table if exists t6 ;
 
10916
-------------------------------------------------------------------------
 
10917
---  Create tables with datediff(col1, '2006-01-01')
 
10918
-------------------------------------------------------------------------
 
10919
create table t1 (col1 date) engine='MYISAM' 
 
10920
partition by range(datediff(col1, '2006-01-01')) 
 
10921
(partition p0 values less than (15),
 
10922
partition p1 values less than maxvalue);
 
10923
create table t2 (col1 date) engine='MYISAM' 
 
10924
partition by list(datediff(col1, '2006-01-01')) 
 
10925
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
10926
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
10927
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
10928
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
10929
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
10930
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
10931
);
 
10932
create table t3 (col1 date) engine='MYISAM' 
 
10933
partition by hash(datediff(col1, '2006-01-01'));
 
10934
create table t4 (colint int, col1 date) engine='MYISAM' 
 
10935
partition by range(colint) 
 
10936
subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 
 
10937
(partition p0 values less than (15),
 
10938
partition p1 values less than maxvalue);
 
10939
create table t5 (colint int, col1 date) engine='MYISAM' 
 
10940
partition by list(colint)
 
10941
subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 
 
10942
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
10943
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
10944
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
10945
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
10946
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
10947
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
10948
);
 
10949
create table t6 (colint int, col1 date) engine='MYISAM' 
 
10950
partition by range(colint) 
 
10951
(partition p0 values less than (datediff('2006-02-02', '2006-01-01')),
 
10952
partition p1 values less than maxvalue);
 
10953
-------------------------------------------------------------------------
 
10954
---  Access tables with datediff(col1, '2006-01-01') 
 
10955
-------------------------------------------------------------------------
 
10956
insert into t1 values ('2006-02-03');
 
10957
insert into t1 values ('2006-01-17');
 
10958
insert into t2 values ('2006-02-03');
 
10959
insert into t2 values ('2006-01-17');
 
10960
insert into t2 values ('2006-01-25');
 
10961
insert into t3 values ('2006-02-03');
 
10962
insert into t3 values ('2006-01-17');
 
10963
insert into t3 values ('2006-01-25');
 
10964
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
 
10965
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
 
10966
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
 
10967
select datediff(col1, '2006-01-01') from t1 order by col1;
 
10968
datediff(col1, '2006-01-01')
 
10969
16
 
10970
33
 
10971
select * from t1 order by col1;
 
10972
col1
 
10973
2006-01-17
 
10974
2006-02-03
 
10975
select * from t2 order by col1;
 
10976
col1
 
10977
2006-01-17
 
10978
2006-01-25
 
10979
2006-02-03
 
10980
select * from t3 order by col1;
 
10981
col1
 
10982
2006-01-17
 
10983
2006-01-25
 
10984
2006-02-03
 
10985
select * from t4 order by colint;
 
10986
colint  col1
 
10987
1       2006-02-03
 
10988
2       2006-01-17
 
10989
3       2006-01-25
 
10990
4       2006-02-05
 
10991
select * from t5 order by colint;
 
10992
colint  col1
 
10993
1       2006-02-03
 
10994
2       2006-01-17
 
10995
3       2006-01-25
 
10996
4       2006-02-05
 
10997
select * from t6 order by colint;
 
10998
colint  col1
 
10999
1       2006-02-03
 
11000
2       2006-01-17
 
11001
3       2006-01-25
 
11002
4       2006-02-05
 
11003
update t1 set col1='2006-02-06' where col1='2006-02-03';
 
11004
update t2 set col1='2006-02-06' where col1='2006-02-03';
 
11005
update t3 set col1='2006-02-06' where col1='2006-02-03';
 
11006
update t4 set col1='2006-02-06' where col1='2006-02-03';
 
11007
update t5 set col1='2006-02-06' where col1='2006-02-03';
 
11008
update t6 set col1='2006-02-06' where col1='2006-02-03';
 
11009
select * from t1 order by col1;
 
11010
col1
 
11011
2006-01-17
 
11012
2006-02-06
 
11013
select * from t2 order by col1;
 
11014
col1
 
11015
2006-01-17
 
11016
2006-01-25
 
11017
2006-02-06
 
11018
select * from t3 order by col1;
 
11019
col1
 
11020
2006-01-17
 
11021
2006-01-25
 
11022
2006-02-06
 
11023
select * from t4 order by colint;
 
11024
colint  col1
 
11025
1       2006-02-06
 
11026
2       2006-01-17
 
11027
3       2006-01-25
 
11028
4       2006-02-05
 
11029
select * from t5 order by colint;
 
11030
colint  col1
 
11031
1       2006-02-06
 
11032
2       2006-01-17
 
11033
3       2006-01-25
 
11034
4       2006-02-05
 
11035
select * from t6 order by colint;
 
11036
colint  col1
 
11037
1       2006-02-06
 
11038
2       2006-01-17
 
11039
3       2006-01-25
 
11040
4       2006-02-05
 
11041
-------------------------------------------------------------------------
 
11042
---  Alter tables with datediff(col1, '2006-01-01')
 
11043
-------------------------------------------------------------------------
 
11044
drop table if exists t11 ;
 
11045
drop table if exists t22 ;
 
11046
drop table if exists t33 ;
 
11047
drop table if exists t44 ;
 
11048
drop table if exists t55 ;
 
11049
drop table if exists t66 ;
 
11050
create table t11 engine='MYISAM' as select * from t1;
 
11051
create table t22 engine='MYISAM' as select * from t2;
 
11052
create table t33 engine='MYISAM' as select * from t3;
 
11053
create table t44 engine='MYISAM' as select * from t4;
 
11054
create table t55 engine='MYISAM' as select * from t5;
 
11055
create table t66 engine='MYISAM' as select * from t6;
 
11056
alter table t11
 
11057
partition by range(datediff(col1, '2006-01-01')) 
 
11058
(partition p0 values less than (15),
 
11059
partition p1 values less than maxvalue);
 
11060
alter table t22
 
11061
partition by list(datediff(col1, '2006-01-01')) 
 
11062
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
11063
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
11064
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
11065
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
11066
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
11067
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
11068
);
 
11069
alter table t33
 
11070
partition by hash(datediff(col1, '2006-01-01'));
 
11071
alter table t44
 
11072
partition by range(colint) 
 
11073
subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 
 
11074
(partition p0 values less than (15),
 
11075
partition p1 values less than maxvalue);
 
11076
alter table t55
 
11077
partition by list(colint)
 
11078
subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 
 
11079
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
11080
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
11081
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
11082
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
11083
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
11084
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
11085
);
 
11086
alter table t66
 
11087
partition by range(colint) 
 
11088
(partition p0 values less than (datediff('2006-02-02', '2006-01-01')),
 
11089
partition p1 values less than maxvalue);
 
11090
select * from t11 order by col1;
 
11091
col1
 
11092
2006-01-17
 
11093
2006-02-06
 
11094
select * from t22 order by col1;
 
11095
col1
 
11096
2006-01-17
 
11097
2006-01-25
 
11098
2006-02-06
 
11099
select * from t33 order by col1;
 
11100
col1
 
11101
2006-01-17
 
11102
2006-01-25
 
11103
2006-02-06
 
11104
select * from t44 order by colint;
 
11105
colint  col1
 
11106
1       2006-02-06
 
11107
2       2006-01-17
 
11108
3       2006-01-25
 
11109
4       2006-02-05
 
11110
select * from t55 order by colint;
 
11111
colint  col1
 
11112
1       2006-02-06
 
11113
2       2006-01-17
 
11114
3       2006-01-25
 
11115
4       2006-02-05
 
11116
select * from t66 order by colint;
 
11117
colint  col1
 
11118
1       2006-02-06
 
11119
2       2006-01-17
 
11120
3       2006-01-25
 
11121
4       2006-02-05
 
11122
---------------------------
 
11123
---- some alter table begin
 
11124
---------------------------
 
11125
alter table t11
 
11126
reorganize partition p0,p1 into
 
11127
(partition s1 values less than maxvalue);
 
11128
select * from t11 order by col1;
 
11129
col1
 
11130
2006-01-17
 
11131
2006-02-06
 
11132
alter table t11
 
11133
reorganize partition s1 into
 
11134
(partition p0 values less than (15),
 
11135
partition p1 values less than maxvalue);
 
11136
select * from t11 order by col1;
 
11137
col1
 
11138
2006-01-17
 
11139
2006-02-06
 
11140
alter table t55
 
11141
partition by list(colint)
 
11142
subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 5 
 
11143
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
11144
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
11145
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
11146
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
11147
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
11148
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
11149
);
 
11150
show create table t55;
 
11151
Table   Create Table
 
11152
t55     CREATE TABLE `t55` (
 
11153
  `colint` int(11) DEFAULT NULL,
 
11154
  `col1` date DEFAULT NULL
 
11155
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (datediff(col1, '2006-01-01')) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
 
11156
select * from t55 order by colint;
 
11157
colint  col1
 
11158
1       2006-02-06
 
11159
2       2006-01-17
 
11160
3       2006-01-25
 
11161
4       2006-02-05
 
11162
alter table t66
 
11163
reorganize partition p0,p1 into
 
11164
(partition s1 values less than maxvalue);
 
11165
select * from t66 order by colint;
 
11166
colint  col1
 
11167
1       2006-02-06
 
11168
2       2006-01-17
 
11169
3       2006-01-25
 
11170
4       2006-02-05
 
11171
alter table t66
 
11172
reorganize partition s1 into
 
11173
(partition p0 values less than (datediff('2006-02-02', '2006-01-01')),
 
11174
partition p1 values less than maxvalue);
 
11175
select * from t66 order by colint;
 
11176
colint  col1
 
11177
1       2006-02-06
 
11178
2       2006-01-17
 
11179
3       2006-01-25
 
11180
4       2006-02-05
 
11181
alter table t66
 
11182
reorganize partition p0,p1 into
 
11183
(partition s1 values less than maxvalue);
 
11184
select * from t66 order by colint;
 
11185
colint  col1
 
11186
1       2006-02-06
 
11187
2       2006-01-17
 
11188
3       2006-01-25
 
11189
4       2006-02-05
 
11190
alter table t66
 
11191
reorganize partition s1 into
 
11192
(partition p0 values less than (datediff('2006-02-02', '2006-01-01')),
 
11193
partition p1 values less than maxvalue);
 
11194
select * from t66 order by colint;
 
11195
colint  col1
 
11196
1       2006-02-06
 
11197
2       2006-01-17
 
11198
3       2006-01-25
 
11199
4       2006-02-05
 
11200
-------------------------------------------------------------------------
 
11201
---  Delete rows and partitions of tables with datediff(col1, '2006-01-01')
 
11202
-------------------------------------------------------------------------
 
11203
delete from t1 where col1='2006-01-17';
 
11204
delete from t2 where col1='2006-01-17';
 
11205
delete from t3 where col1='2006-01-17';
 
11206
delete from t4 where col1='2006-01-17';
 
11207
delete from t5 where col1='2006-01-17';
 
11208
delete from t6 where col1='2006-01-17';
 
11209
select * from t1 order by col1;
 
11210
col1
 
11211
2006-02-06
 
11212
select * from t2 order by col1;
 
11213
col1
 
11214
2006-01-25
 
11215
2006-02-06
 
11216
select * from t3 order by col1;
 
11217
col1
 
11218
2006-01-25
 
11219
2006-02-06
 
11220
select * from t4 order by colint;
 
11221
colint  col1
 
11222
1       2006-02-06
 
11223
3       2006-01-25
 
11224
4       2006-02-05
 
11225
select * from t5 order by colint;
 
11226
colint  col1
 
11227
1       2006-02-06
 
11228
3       2006-01-25
 
11229
4       2006-02-05
 
11230
insert into t1 values ('2006-01-17');
 
11231
insert into t2 values ('2006-01-17');
 
11232
insert into t3 values ('2006-01-17');
 
11233
insert into t4 values (60,'2006-01-17');
 
11234
insert into t5 values (60,'2006-01-17');
 
11235
insert into t6 values (60,'2006-01-17');
 
11236
select * from t1 order by col1;
 
11237
col1
 
11238
2006-01-17
 
11239
2006-02-06
 
11240
select * from t2 order by col1;
 
11241
col1
 
11242
2006-01-17
 
11243
2006-01-25
 
11244
2006-02-06
 
11245
select * from t3 order by col1;
 
11246
col1
 
11247
2006-01-17
 
11248
2006-01-25
 
11249
2006-02-06
 
11250
select * from t4 order by colint;
 
11251
colint  col1
 
11252
1       2006-02-06
 
11253
3       2006-01-25
 
11254
4       2006-02-05
 
11255
60      2006-01-17
 
11256
select * from t5 order by colint;
 
11257
colint  col1
 
11258
1       2006-02-06
 
11259
3       2006-01-25
 
11260
4       2006-02-05
 
11261
60      2006-01-17
 
11262
select * from t6 order by colint;
 
11263
colint  col1
 
11264
1       2006-02-06
 
11265
3       2006-01-25
 
11266
4       2006-02-05
 
11267
60      2006-01-17
 
11268
alter table t1 drop partition p0;
 
11269
alter table t2 drop partition p0;
 
11270
alter table t4 drop partition p0;
 
11271
alter table t5 drop partition p0;
 
11272
alter table t6 drop partition p0;
 
11273
select * from t1 order by col1;
 
11274
col1
 
11275
2006-01-17
 
11276
2006-02-06
 
11277
select * from t2 order by col1;
 
11278
col1
 
11279
2006-01-17
 
11280
2006-01-25
 
11281
2006-02-06
 
11282
select * from t3 order by col1;
 
11283
col1
 
11284
2006-01-17
 
11285
2006-01-25
 
11286
2006-02-06
 
11287
select * from t4 order by colint;
 
11288
colint  col1
 
11289
60      2006-01-17
 
11290
select * from t5 order by colint;
 
11291
colint  col1
 
11292
60      2006-01-17
 
11293
select * from t6 order by colint;
 
11294
colint  col1
 
11295
60      2006-01-17
 
11296
-------------------------------------------------------------------------
 
11297
---  Delete rows and partitions of tables with datediff(col1, '2006-01-01')
 
11298
-------------------------------------------------------------------------
 
11299
delete from t11 where col1='2006-01-17';
 
11300
delete from t22 where col1='2006-01-17';
 
11301
delete from t33 where col1='2006-01-17';
 
11302
delete from t44 where col1='2006-01-17';
 
11303
delete from t55 where col1='2006-01-17';
 
11304
delete from t66 where col1='2006-01-17';
 
11305
select * from t11 order by col1;
 
11306
col1
 
11307
2006-02-06
 
11308
select * from t22 order by col1;
 
11309
col1
 
11310
2006-01-25
 
11311
2006-02-06
 
11312
select * from t33 order by col1;
 
11313
col1
 
11314
2006-01-25
 
11315
2006-02-06
 
11316
select * from t44 order by colint;
 
11317
colint  col1
 
11318
1       2006-02-06
 
11319
3       2006-01-25
 
11320
4       2006-02-05
 
11321
select * from t55 order by colint;
 
11322
colint  col1
 
11323
1       2006-02-06
 
11324
3       2006-01-25
 
11325
4       2006-02-05
 
11326
insert into t11 values ('2006-01-17');
 
11327
insert into t22 values ('2006-01-17');
 
11328
insert into t33 values ('2006-01-17');
 
11329
insert into t44 values (60,'2006-01-17');
 
11330
insert into t55 values (60,'2006-01-17');
 
11331
insert into t66 values (60,'2006-01-17');
 
11332
select * from t11 order by col1;
 
11333
col1
 
11334
2006-01-17
 
11335
2006-02-06
 
11336
select * from t22 order by col1;
 
11337
col1
 
11338
2006-01-17
 
11339
2006-01-25
 
11340
2006-02-06
 
11341
select * from t33 order by col1;
 
11342
col1
 
11343
2006-01-17
 
11344
2006-01-25
 
11345
2006-02-06
 
11346
select * from t44 order by colint;
 
11347
colint  col1
 
11348
1       2006-02-06
 
11349
3       2006-01-25
 
11350
4       2006-02-05
 
11351
60      2006-01-17
 
11352
select * from t55 order by colint;
 
11353
colint  col1
 
11354
1       2006-02-06
 
11355
3       2006-01-25
 
11356
4       2006-02-05
 
11357
60      2006-01-17
 
11358
select * from t66 order by colint;
 
11359
colint  col1
 
11360
1       2006-02-06
 
11361
3       2006-01-25
 
11362
4       2006-02-05
 
11363
60      2006-01-17
 
11364
alter table t11 drop partition p0;
 
11365
alter table t22 drop partition p0;
 
11366
alter table t44 drop partition p0;
 
11367
alter table t55 drop partition p0;
 
11368
alter table t66 drop partition p0;
 
11369
select * from t11 order by col1;
 
11370
col1
 
11371
2006-01-17
 
11372
2006-02-06
 
11373
select * from t22 order by col1;
 
11374
col1
 
11375
2006-01-17
 
11376
2006-01-25
 
11377
2006-02-06
 
11378
select * from t33 order by col1;
 
11379
col1
 
11380
2006-01-17
 
11381
2006-01-25
 
11382
2006-02-06
 
11383
select * from t44 order by colint;
 
11384
colint  col1
 
11385
60      2006-01-17
 
11386
select * from t55 order by colint;
 
11387
colint  col1
 
11388
60      2006-01-17
 
11389
select * from t66 order by colint;
 
11390
colint  col1
 
11391
60      2006-01-17
 
11392
-------------------------
 
11393
---- some alter table end
 
11394
-------------------------
 
11395
drop table if exists t1 ;
 
11396
drop table if exists t2 ;
 
11397
drop table if exists t3 ;
 
11398
drop table if exists t4 ;
 
11399
drop table if exists t5 ;
 
11400
drop table if exists t6 ;
 
11401
drop table if exists t11 ;
 
11402
drop table if exists t22 ;
 
11403
drop table if exists t33 ;
 
11404
drop table if exists t44 ;
 
11405
drop table if exists t55 ;
 
11406
drop table if exists t66 ;
 
11407
-------------------------------------------------------------------------
 
11408
---  weekday(col1)  in partition with coltype  date
 
11409
-------------------------------------------------------------------------
 
11410
drop table if exists t1 ;
 
11411
drop table if exists t2 ;
 
11412
drop table if exists t3 ;
 
11413
drop table if exists t4 ;
 
11414
drop table if exists t5 ;
 
11415
drop table if exists t6 ;
 
11416
-------------------------------------------------------------------------
 
11417
---  Create tables with weekday(col1)
 
11418
-------------------------------------------------------------------------
 
11419
create table t1 (col1 date) engine='MYISAM' 
 
11420
partition by range(weekday(col1)) 
 
11421
(partition p0 values less than (15),
 
11422
partition p1 values less than maxvalue);
 
11423
create table t2 (col1 date) engine='MYISAM' 
 
11424
partition by list(weekday(col1)) 
 
11425
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
11426
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
11427
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
11428
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
11429
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
11430
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
11431
);
 
11432
create table t3 (col1 date) engine='MYISAM' 
 
11433
partition by hash(weekday(col1));
 
11434
create table t4 (colint int, col1 date) engine='MYISAM' 
 
11435
partition by range(colint) 
 
11436
subpartition by hash(weekday(col1)) subpartitions 2 
 
11437
(partition p0 values less than (15),
 
11438
partition p1 values less than maxvalue);
 
11439
create table t5 (colint int, col1 date) engine='MYISAM' 
 
11440
partition by list(colint)
 
11441
subpartition by hash(weekday(col1)) subpartitions 2 
 
11442
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
11443
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
11444
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
11445
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
11446
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
11447
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
11448
);
 
11449
create table t6 (colint int, col1 date) engine='MYISAM' 
 
11450
partition by range(colint) 
 
11451
(partition p0 values less than (weekday('2006-10-14')),
 
11452
partition p1 values less than maxvalue);
 
11453
-------------------------------------------------------------------------
 
11454
---  Access tables with weekday(col1) 
 
11455
-------------------------------------------------------------------------
 
11456
insert into t1 values ('2006-12-03');
 
11457
insert into t1 values ('2006-11-17');
 
11458
insert into t2 values ('2006-12-03');
 
11459
insert into t2 values ('2006-11-17');
 
11460
insert into t2 values ('2006-05-25');
 
11461
insert into t3 values ('2006-12-03');
 
11462
insert into t3 values ('2006-11-17');
 
11463
insert into t3 values ('2006-05-25');
 
11464
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
 
11465
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
 
11466
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
 
11467
select weekday(col1) from t1 order by col1;
 
11468
weekday(col1)
 
11469
4
 
11470
6
 
11471
select * from t1 order by col1;
 
11472
col1
 
11473
2006-11-17
 
11474
2006-12-03
 
11475
select * from t2 order by col1;
 
11476
col1
 
11477
2006-05-25
 
11478
2006-11-17
 
11479
2006-12-03
 
11480
select * from t3 order by col1;
 
11481
col1
 
11482
2006-05-25
 
11483
2006-11-17
 
11484
2006-12-03
 
11485
select * from t4 order by colint;
 
11486
colint  col1
 
11487
1       2006-02-03
 
11488
2       2006-01-17
 
11489
3       2006-01-25
 
11490
4       2006-02-05
 
11491
select * from t5 order by colint;
 
11492
colint  col1
 
11493
1       2006-02-03
 
11494
2       2006-01-17
 
11495
3       2006-01-25
 
11496
4       2006-02-05
 
11497
select * from t6 order by colint;
 
11498
colint  col1
 
11499
1       2006-02-03
 
11500
2       2006-01-17
 
11501
3       2006-01-25
 
11502
4       2006-02-05
 
11503
update t1 set col1='2006-02-06' where col1='2006-12-03';
 
11504
update t2 set col1='2006-02-06' where col1='2006-12-03';
 
11505
update t3 set col1='2006-02-06' where col1='2006-12-03';
 
11506
update t4 set col1='2006-02-06' where col1='2006-12-03';
 
11507
update t5 set col1='2006-02-06' where col1='2006-12-03';
 
11508
update t6 set col1='2006-02-06' where col1='2006-12-03';
 
11509
select * from t1 order by col1;
 
11510
col1
 
11511
2006-02-06
 
11512
2006-11-17
 
11513
select * from t2 order by col1;
 
11514
col1
 
11515
2006-02-06
 
11516
2006-05-25
 
11517
2006-11-17
 
11518
select * from t3 order by col1;
 
11519
col1
 
11520
2006-02-06
 
11521
2006-05-25
 
11522
2006-11-17
 
11523
select * from t4 order by colint;
 
11524
colint  col1
 
11525
1       2006-02-03
 
11526
2       2006-01-17
 
11527
3       2006-01-25
 
11528
4       2006-02-05
 
11529
select * from t5 order by colint;
 
11530
colint  col1
 
11531
1       2006-02-03
 
11532
2       2006-01-17
 
11533
3       2006-01-25
 
11534
4       2006-02-05
 
11535
select * from t6 order by colint;
 
11536
colint  col1
 
11537
1       2006-02-03
 
11538
2       2006-01-17
 
11539
3       2006-01-25
 
11540
4       2006-02-05
 
11541
-------------------------------------------------------------------------
 
11542
---  Alter tables with weekday(col1)
 
11543
-------------------------------------------------------------------------
 
11544
drop table if exists t11 ;
 
11545
drop table if exists t22 ;
 
11546
drop table if exists t33 ;
 
11547
drop table if exists t44 ;
 
11548
drop table if exists t55 ;
 
11549
drop table if exists t66 ;
 
11550
create table t11 engine='MYISAM' as select * from t1;
 
11551
create table t22 engine='MYISAM' as select * from t2;
 
11552
create table t33 engine='MYISAM' as select * from t3;
 
11553
create table t44 engine='MYISAM' as select * from t4;
 
11554
create table t55 engine='MYISAM' as select * from t5;
 
11555
create table t66 engine='MYISAM' as select * from t6;
 
11556
alter table t11
 
11557
partition by range(weekday(col1)) 
 
11558
(partition p0 values less than (15),
 
11559
partition p1 values less than maxvalue);
 
11560
alter table t22
 
11561
partition by list(weekday(col1)) 
 
11562
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
11563
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
11564
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
11565
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
11566
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
11567
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
11568
);
 
11569
alter table t33
 
11570
partition by hash(weekday(col1));
 
11571
alter table t44
 
11572
partition by range(colint) 
 
11573
subpartition by hash(weekday(col1)) subpartitions 2 
 
11574
(partition p0 values less than (15),
 
11575
partition p1 values less than maxvalue);
 
11576
alter table t55
 
11577
partition by list(colint)
 
11578
subpartition by hash(weekday(col1)) subpartitions 2 
 
11579
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
11580
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
11581
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
11582
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
11583
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
11584
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
11585
);
 
11586
alter table t66
 
11587
partition by range(colint) 
 
11588
(partition p0 values less than (weekday('2006-10-14')),
 
11589
partition p1 values less than maxvalue);
 
11590
select * from t11 order by col1;
 
11591
col1
 
11592
2006-02-06
 
11593
2006-11-17
 
11594
select * from t22 order by col1;
 
11595
col1
 
11596
2006-02-06
 
11597
2006-05-25
 
11598
2006-11-17
 
11599
select * from t33 order by col1;
 
11600
col1
 
11601
2006-02-06
 
11602
2006-05-25
 
11603
2006-11-17
 
11604
select * from t44 order by colint;
 
11605
colint  col1
 
11606
1       2006-02-03
 
11607
2       2006-01-17
 
11608
3       2006-01-25
 
11609
4       2006-02-05
 
11610
select * from t55 order by colint;
 
11611
colint  col1
 
11612
1       2006-02-03
 
11613
2       2006-01-17
 
11614
3       2006-01-25
 
11615
4       2006-02-05
 
11616
select * from t66 order by colint;
 
11617
colint  col1
 
11618
1       2006-02-03
 
11619
2       2006-01-17
 
11620
3       2006-01-25
 
11621
4       2006-02-05
 
11622
---------------------------
 
11623
---- some alter table begin
 
11624
---------------------------
 
11625
alter table t11
 
11626
reorganize partition p0,p1 into
 
11627
(partition s1 values less than maxvalue);
 
11628
select * from t11 order by col1;
 
11629
col1
 
11630
2006-02-06
 
11631
2006-11-17
 
11632
alter table t11
 
11633
reorganize partition s1 into
 
11634
(partition p0 values less than (15),
 
11635
partition p1 values less than maxvalue);
 
11636
select * from t11 order by col1;
 
11637
col1
 
11638
2006-02-06
 
11639
2006-11-17
 
11640
alter table t55
 
11641
partition by list(colint)
 
11642
subpartition by hash(weekday(col1)) subpartitions 5 
 
11643
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
11644
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
11645
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
11646
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
11647
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
11648
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
11649
);
 
11650
show create table t55;
 
11651
Table   Create Table
 
11652
t55     CREATE TABLE `t55` (
 
11653
  `colint` int(11) DEFAULT NULL,
 
11654
  `col1` date DEFAULT NULL
 
11655
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (weekday(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
 
11656
select * from t55 order by colint;
 
11657
colint  col1
 
11658
1       2006-02-03
 
11659
2       2006-01-17
 
11660
3       2006-01-25
 
11661
4       2006-02-05
 
11662
alter table t66
 
11663
reorganize partition p0,p1 into
 
11664
(partition s1 values less than maxvalue);
 
11665
select * from t66 order by colint;
 
11666
colint  col1
 
11667
1       2006-02-03
 
11668
2       2006-01-17
 
11669
3       2006-01-25
 
11670
4       2006-02-05
 
11671
alter table t66
 
11672
reorganize partition s1 into
 
11673
(partition p0 values less than (weekday('2006-10-14')),
 
11674
partition p1 values less than maxvalue);
 
11675
select * from t66 order by colint;
 
11676
colint  col1
 
11677
1       2006-02-03
 
11678
2       2006-01-17
 
11679
3       2006-01-25
 
11680
4       2006-02-05
 
11681
alter table t66
 
11682
reorganize partition p0,p1 into
 
11683
(partition s1 values less than maxvalue);
 
11684
select * from t66 order by colint;
 
11685
colint  col1
 
11686
1       2006-02-03
 
11687
2       2006-01-17
 
11688
3       2006-01-25
 
11689
4       2006-02-05
 
11690
alter table t66
 
11691
reorganize partition s1 into
 
11692
(partition p0 values less than (weekday('2006-10-14')),
 
11693
partition p1 values less than maxvalue);
 
11694
select * from t66 order by colint;
 
11695
colint  col1
 
11696
1       2006-02-03
 
11697
2       2006-01-17
 
11698
3       2006-01-25
 
11699
4       2006-02-05
 
11700
-------------------------------------------------------------------------
 
11701
---  Delete rows and partitions of tables with weekday(col1)
 
11702
-------------------------------------------------------------------------
 
11703
delete from t1 where col1='2006-11-17';
 
11704
delete from t2 where col1='2006-11-17';
 
11705
delete from t3 where col1='2006-11-17';
 
11706
delete from t4 where col1='2006-11-17';
 
11707
delete from t5 where col1='2006-11-17';
 
11708
delete from t6 where col1='2006-11-17';
 
11709
select * from t1 order by col1;
 
11710
col1
 
11711
2006-02-06
 
11712
select * from t2 order by col1;
 
11713
col1
 
11714
2006-02-06
 
11715
2006-05-25
 
11716
select * from t3 order by col1;
 
11717
col1
 
11718
2006-02-06
 
11719
2006-05-25
 
11720
select * from t4 order by colint;
 
11721
colint  col1
 
11722
1       2006-02-03
 
11723
2       2006-01-17
 
11724
3       2006-01-25
 
11725
4       2006-02-05
 
11726
select * from t5 order by colint;
 
11727
colint  col1
 
11728
1       2006-02-03
 
11729
2       2006-01-17
 
11730
3       2006-01-25
 
11731
4       2006-02-05
 
11732
insert into t1 values ('2006-11-17');
 
11733
insert into t2 values ('2006-11-17');
 
11734
insert into t3 values ('2006-11-17');
 
11735
insert into t4 values (60,'2006-11-17');
 
11736
insert into t5 values (60,'2006-11-17');
 
11737
insert into t6 values (60,'2006-11-17');
 
11738
select * from t1 order by col1;
 
11739
col1
 
11740
2006-02-06
 
11741
2006-11-17
 
11742
select * from t2 order by col1;
 
11743
col1
 
11744
2006-02-06
 
11745
2006-05-25
 
11746
2006-11-17
 
11747
select * from t3 order by col1;
 
11748
col1
 
11749
2006-02-06
 
11750
2006-05-25
 
11751
2006-11-17
 
11752
select * from t4 order by colint;
 
11753
colint  col1
 
11754
1       2006-02-03
 
11755
2       2006-01-17
 
11756
3       2006-01-25
 
11757
4       2006-02-05
 
11758
60      2006-11-17
 
11759
select * from t5 order by colint;
 
11760
colint  col1
 
11761
1       2006-02-03
 
11762
2       2006-01-17
 
11763
3       2006-01-25
 
11764
4       2006-02-05
 
11765
60      2006-11-17
 
11766
select * from t6 order by colint;
 
11767
colint  col1
 
11768
1       2006-02-03
 
11769
2       2006-01-17
 
11770
3       2006-01-25
 
11771
4       2006-02-05
 
11772
60      2006-11-17
 
11773
alter table t1 drop partition p0;
 
11774
alter table t2 drop partition p0;
 
11775
alter table t4 drop partition p0;
 
11776
alter table t5 drop partition p0;
 
11777
alter table t6 drop partition p0;
 
11778
select * from t1 order by col1;
 
11779
col1
 
11780
select * from t2 order by col1;
 
11781
col1
 
11782
select * from t3 order by col1;
 
11783
col1
 
11784
2006-02-06
 
11785
2006-05-25
 
11786
2006-11-17
 
11787
select * from t4 order by colint;
 
11788
colint  col1
 
11789
60      2006-11-17
 
11790
select * from t5 order by colint;
 
11791
colint  col1
 
11792
60      2006-11-17
 
11793
select * from t6 order by colint;
 
11794
colint  col1
 
11795
60      2006-11-17
 
11796
-------------------------------------------------------------------------
 
11797
---  Delete rows and partitions of tables with weekday(col1)
 
11798
-------------------------------------------------------------------------
 
11799
delete from t11 where col1='2006-11-17';
 
11800
delete from t22 where col1='2006-11-17';
 
11801
delete from t33 where col1='2006-11-17';
 
11802
delete from t44 where col1='2006-11-17';
 
11803
delete from t55 where col1='2006-11-17';
 
11804
delete from t66 where col1='2006-11-17';
 
11805
select * from t11 order by col1;
 
11806
col1
 
11807
2006-02-06
 
11808
select * from t22 order by col1;
 
11809
col1
 
11810
2006-02-06
 
11811
2006-05-25
 
11812
select * from t33 order by col1;
 
11813
col1
 
11814
2006-02-06
 
11815
2006-05-25
 
11816
select * from t44 order by colint;
 
11817
colint  col1
 
11818
1       2006-02-03
 
11819
2       2006-01-17
 
11820
3       2006-01-25
 
11821
4       2006-02-05
 
11822
select * from t55 order by colint;
 
11823
colint  col1
 
11824
1       2006-02-03
 
11825
2       2006-01-17
 
11826
3       2006-01-25
 
11827
4       2006-02-05
 
11828
insert into t11 values ('2006-11-17');
 
11829
insert into t22 values ('2006-11-17');
 
11830
insert into t33 values ('2006-11-17');
 
11831
insert into t44 values (60,'2006-11-17');
 
11832
insert into t55 values (60,'2006-11-17');
 
11833
insert into t66 values (60,'2006-11-17');
 
11834
select * from t11 order by col1;
 
11835
col1
 
11836
2006-02-06
 
11837
2006-11-17
 
11838
select * from t22 order by col1;
 
11839
col1
 
11840
2006-02-06
 
11841
2006-05-25
 
11842
2006-11-17
 
11843
select * from t33 order by col1;
 
11844
col1
 
11845
2006-02-06
 
11846
2006-05-25
 
11847
2006-11-17
 
11848
select * from t44 order by colint;
 
11849
colint  col1
 
11850
1       2006-02-03
 
11851
2       2006-01-17
 
11852
3       2006-01-25
 
11853
4       2006-02-05
 
11854
60      2006-11-17
 
11855
select * from t55 order by colint;
 
11856
colint  col1
 
11857
1       2006-02-03
 
11858
2       2006-01-17
 
11859
3       2006-01-25
 
11860
4       2006-02-05
 
11861
60      2006-11-17
 
11862
select * from t66 order by colint;
 
11863
colint  col1
 
11864
1       2006-02-03
 
11865
2       2006-01-17
 
11866
3       2006-01-25
 
11867
4       2006-02-05
 
11868
60      2006-11-17
 
11869
alter table t11 drop partition p0;
 
11870
alter table t22 drop partition p0;
 
11871
alter table t44 drop partition p0;
 
11872
alter table t55 drop partition p0;
 
11873
alter table t66 drop partition p0;
 
11874
select * from t11 order by col1;
 
11875
col1
 
11876
select * from t22 order by col1;
 
11877
col1
 
11878
select * from t33 order by col1;
 
11879
col1
 
11880
2006-02-06
 
11881
2006-05-25
 
11882
2006-11-17
 
11883
select * from t44 order by colint;
 
11884
colint  col1
 
11885
60      2006-11-17
 
11886
select * from t55 order by colint;
 
11887
colint  col1
 
11888
60      2006-11-17
 
11889
select * from t66 order by colint;
 
11890
colint  col1
 
11891
60      2006-11-17
 
11892
-------------------------
 
11893
---- some alter table end
 
11894
-------------------------
 
11895
drop table if exists t1 ;
 
11896
drop table if exists t2 ;
 
11897
drop table if exists t3 ;
 
11898
drop table if exists t4 ;
 
11899
drop table if exists t5 ;
 
11900
drop table if exists t6 ;
 
11901
drop table if exists t11 ;
 
11902
drop table if exists t22 ;
 
11903
drop table if exists t33 ;
 
11904
drop table if exists t44 ;
 
11905
drop table if exists t55 ;
 
11906
drop table if exists t66 ;
 
11907
-------------------------------------------------------------------------
 
11908
---  year(col1)-1990  in partition with coltype  date
 
11909
-------------------------------------------------------------------------
 
11910
drop table if exists t1 ;
 
11911
drop table if exists t2 ;
 
11912
drop table if exists t3 ;
 
11913
drop table if exists t4 ;
 
11914
drop table if exists t5 ;
 
11915
drop table if exists t6 ;
 
11916
-------------------------------------------------------------------------
 
11917
---  Create tables with year(col1)-1990
 
11918
-------------------------------------------------------------------------
 
11919
create table t1 (col1 date) engine='MYISAM' 
 
11920
partition by range(year(col1)-1990) 
 
11921
(partition p0 values less than (15),
 
11922
partition p1 values less than maxvalue);
 
11923
create table t2 (col1 date) engine='MYISAM' 
 
11924
partition by list(year(col1)-1990) 
 
11925
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
11926
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
11927
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
11928
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
11929
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
11930
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
11931
);
 
11932
create table t3 (col1 date) engine='MYISAM' 
 
11933
partition by hash(year(col1)-1990);
 
11934
create table t4 (colint int, col1 date) engine='MYISAM' 
 
11935
partition by range(colint) 
 
11936
subpartition by hash(year(col1)-1990) subpartitions 2 
 
11937
(partition p0 values less than (15),
 
11938
partition p1 values less than maxvalue);
 
11939
create table t5 (colint int, col1 date) engine='MYISAM' 
 
11940
partition by list(colint)
 
11941
subpartition by hash(year(col1)-1990) subpartitions 2 
 
11942
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
11943
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
11944
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
11945
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
11946
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
11947
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
11948
);
 
11949
create table t6 (colint int, col1 date) engine='MYISAM' 
 
11950
partition by range(colint) 
 
11951
(partition p0 values less than (year('2005-10-14')-1990),
 
11952
partition p1 values less than maxvalue);
 
11953
-------------------------------------------------------------------------
 
11954
---  Access tables with year(col1)-1990 
 
11955
-------------------------------------------------------------------------
 
11956
insert into t1 values ('1996-01-03');
 
11957
insert into t1 values ('2000-02-17');
 
11958
insert into t2 values ('1996-01-03');
 
11959
insert into t2 values ('2000-02-17');
 
11960
insert into t2 values ('2004-05-25');
 
11961
insert into t3 values ('1996-01-03');
 
11962
insert into t3 values ('2000-02-17');
 
11963
insert into t3 values ('2004-05-25');
 
11964
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
 
11965
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
 
11966
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
 
11967
select year(col1)-1990 from t1 order by col1;
 
11968
year(col1)-1990
 
11969
6
 
11970
10
 
11971
select * from t1 order by col1;
 
11972
col1
 
11973
1996-01-03
 
11974
2000-02-17
 
11975
select * from t2 order by col1;
 
11976
col1
 
11977
1996-01-03
 
11978
2000-02-17
 
11979
2004-05-25
 
11980
select * from t3 order by col1;
 
11981
col1
 
11982
1996-01-03
 
11983
2000-02-17
 
11984
2004-05-25
 
11985
select * from t4 order by colint;
 
11986
colint  col1
 
11987
1       2006-02-03
 
11988
2       2006-01-17
 
11989
3       2006-01-25
 
11990
4       2006-02-05
 
11991
select * from t5 order by colint;
 
11992
colint  col1
 
11993
1       2006-02-03
 
11994
2       2006-01-17
 
11995
3       2006-01-25
 
11996
4       2006-02-05
 
11997
select * from t6 order by colint;
 
11998
colint  col1
 
11999
1       2006-02-03
 
12000
2       2006-01-17
 
12001
3       2006-01-25
 
12002
4       2006-02-05
 
12003
update t1 set col1='2002-02-15' where col1='1996-01-03';
 
12004
update t2 set col1='2002-02-15' where col1='1996-01-03';
 
12005
update t3 set col1='2002-02-15' where col1='1996-01-03';
 
12006
update t4 set col1='2002-02-15' where col1='1996-01-03';
 
12007
update t5 set col1='2002-02-15' where col1='1996-01-03';
 
12008
update t6 set col1='2002-02-15' where col1='1996-01-03';
 
12009
select * from t1 order by col1;
 
12010
col1
 
12011
2000-02-17
 
12012
2002-02-15
 
12013
select * from t2 order by col1;
 
12014
col1
 
12015
2000-02-17
 
12016
2002-02-15
 
12017
2004-05-25
 
12018
select * from t3 order by col1;
 
12019
col1
 
12020
2000-02-17
 
12021
2002-02-15
 
12022
2004-05-25
 
12023
select * from t4 order by colint;
 
12024
colint  col1
 
12025
1       2006-02-03
 
12026
2       2006-01-17
 
12027
3       2006-01-25
 
12028
4       2006-02-05
 
12029
select * from t5 order by colint;
 
12030
colint  col1
 
12031
1       2006-02-03
 
12032
2       2006-01-17
 
12033
3       2006-01-25
 
12034
4       2006-02-05
 
12035
select * from t6 order by colint;
 
12036
colint  col1
 
12037
1       2006-02-03
 
12038
2       2006-01-17
 
12039
3       2006-01-25
 
12040
4       2006-02-05
 
12041
-------------------------------------------------------------------------
 
12042
---  Alter tables with year(col1)-1990
 
12043
-------------------------------------------------------------------------
 
12044
drop table if exists t11 ;
 
12045
drop table if exists t22 ;
 
12046
drop table if exists t33 ;
 
12047
drop table if exists t44 ;
 
12048
drop table if exists t55 ;
 
12049
drop table if exists t66 ;
 
12050
create table t11 engine='MYISAM' as select * from t1;
 
12051
create table t22 engine='MYISAM' as select * from t2;
 
12052
create table t33 engine='MYISAM' as select * from t3;
 
12053
create table t44 engine='MYISAM' as select * from t4;
 
12054
create table t55 engine='MYISAM' as select * from t5;
 
12055
create table t66 engine='MYISAM' as select * from t6;
 
12056
alter table t11
 
12057
partition by range(year(col1)-1990) 
 
12058
(partition p0 values less than (15),
 
12059
partition p1 values less than maxvalue);
 
12060
alter table t22
 
12061
partition by list(year(col1)-1990) 
 
12062
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
12063
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
12064
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
12065
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
12066
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
12067
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
12068
);
 
12069
alter table t33
 
12070
partition by hash(year(col1)-1990);
 
12071
alter table t44
 
12072
partition by range(colint) 
 
12073
subpartition by hash(year(col1)-1990) subpartitions 2 
 
12074
(partition p0 values less than (15),
 
12075
partition p1 values less than maxvalue);
 
12076
alter table t55
 
12077
partition by list(colint)
 
12078
subpartition by hash(year(col1)-1990) subpartitions 2 
 
12079
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
12080
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
12081
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
12082
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
12083
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
12084
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
12085
);
 
12086
alter table t66
 
12087
partition by range(colint) 
 
12088
(partition p0 values less than (year('2005-10-14')-1990),
 
12089
partition p1 values less than maxvalue);
 
12090
select * from t11 order by col1;
 
12091
col1
 
12092
2000-02-17
 
12093
2002-02-15
 
12094
select * from t22 order by col1;
 
12095
col1
 
12096
2000-02-17
 
12097
2002-02-15
 
12098
2004-05-25
 
12099
select * from t33 order by col1;
 
12100
col1
 
12101
2000-02-17
 
12102
2002-02-15
 
12103
2004-05-25
 
12104
select * from t44 order by colint;
 
12105
colint  col1
 
12106
1       2006-02-03
 
12107
2       2006-01-17
 
12108
3       2006-01-25
 
12109
4       2006-02-05
 
12110
select * from t55 order by colint;
 
12111
colint  col1
 
12112
1       2006-02-03
 
12113
2       2006-01-17
 
12114
3       2006-01-25
 
12115
4       2006-02-05
 
12116
select * from t66 order by colint;
 
12117
colint  col1
 
12118
1       2006-02-03
 
12119
2       2006-01-17
 
12120
3       2006-01-25
 
12121
4       2006-02-05
 
12122
---------------------------
 
12123
---- some alter table begin
 
12124
---------------------------
 
12125
alter table t11
 
12126
reorganize partition p0,p1 into
 
12127
(partition s1 values less than maxvalue);
 
12128
select * from t11 order by col1;
 
12129
col1
 
12130
2000-02-17
 
12131
2002-02-15
 
12132
alter table t11
 
12133
reorganize partition s1 into
 
12134
(partition p0 values less than (15),
 
12135
partition p1 values less than maxvalue);
 
12136
select * from t11 order by col1;
 
12137
col1
 
12138
2000-02-17
 
12139
2002-02-15
 
12140
alter table t55
 
12141
partition by list(colint)
 
12142
subpartition by hash(year(col1)-1990) subpartitions 5 
 
12143
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
12144
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
12145
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
12146
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
12147
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
12148
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
12149
);
 
12150
show create table t55;
 
12151
Table   Create Table
 
12152
t55     CREATE TABLE `t55` (
 
12153
  `colint` int(11) DEFAULT NULL,
 
12154
  `col1` date DEFAULT NULL
 
12155
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (year(col1)-1990) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
 
12156
select * from t55 order by colint;
 
12157
colint  col1
 
12158
1       2006-02-03
 
12159
2       2006-01-17
 
12160
3       2006-01-25
 
12161
4       2006-02-05
 
12162
alter table t66
 
12163
reorganize partition p0,p1 into
 
12164
(partition s1 values less than maxvalue);
 
12165
select * from t66 order by colint;
 
12166
colint  col1
 
12167
1       2006-02-03
 
12168
2       2006-01-17
 
12169
3       2006-01-25
 
12170
4       2006-02-05
 
12171
alter table t66
 
12172
reorganize partition s1 into
 
12173
(partition p0 values less than (year('2005-10-14')-1990),
 
12174
partition p1 values less than maxvalue);
 
12175
select * from t66 order by colint;
 
12176
colint  col1
 
12177
1       2006-02-03
 
12178
2       2006-01-17
 
12179
3       2006-01-25
 
12180
4       2006-02-05
 
12181
alter table t66
 
12182
reorganize partition p0,p1 into
 
12183
(partition s1 values less than maxvalue);
 
12184
select * from t66 order by colint;
 
12185
colint  col1
 
12186
1       2006-02-03
 
12187
2       2006-01-17
 
12188
3       2006-01-25
 
12189
4       2006-02-05
 
12190
alter table t66
 
12191
reorganize partition s1 into
 
12192
(partition p0 values less than (year('2005-10-14')-1990),
 
12193
partition p1 values less than maxvalue);
 
12194
select * from t66 order by colint;
 
12195
colint  col1
 
12196
1       2006-02-03
 
12197
2       2006-01-17
 
12198
3       2006-01-25
 
12199
4       2006-02-05
 
12200
-------------------------------------------------------------------------
 
12201
---  Delete rows and partitions of tables with year(col1)-1990
 
12202
-------------------------------------------------------------------------
 
12203
delete from t1 where col1='2000-02-17';
 
12204
delete from t2 where col1='2000-02-17';
 
12205
delete from t3 where col1='2000-02-17';
 
12206
delete from t4 where col1='2000-02-17';
 
12207
delete from t5 where col1='2000-02-17';
 
12208
delete from t6 where col1='2000-02-17';
 
12209
select * from t1 order by col1;
 
12210
col1
 
12211
2002-02-15
 
12212
select * from t2 order by col1;
 
12213
col1
 
12214
2002-02-15
 
12215
2004-05-25
 
12216
select * from t3 order by col1;
 
12217
col1
 
12218
2002-02-15
 
12219
2004-05-25
 
12220
select * from t4 order by colint;
 
12221
colint  col1
 
12222
1       2006-02-03
 
12223
2       2006-01-17
 
12224
3       2006-01-25
 
12225
4       2006-02-05
 
12226
select * from t5 order by colint;
 
12227
colint  col1
 
12228
1       2006-02-03
 
12229
2       2006-01-17
 
12230
3       2006-01-25
 
12231
4       2006-02-05
 
12232
insert into t1 values ('2000-02-17');
 
12233
insert into t2 values ('2000-02-17');
 
12234
insert into t3 values ('2000-02-17');
 
12235
insert into t4 values (60,'2000-02-17');
 
12236
insert into t5 values (60,'2000-02-17');
 
12237
insert into t6 values (60,'2000-02-17');
 
12238
select * from t1 order by col1;
 
12239
col1
 
12240
2000-02-17
 
12241
2002-02-15
 
12242
select * from t2 order by col1;
 
12243
col1
 
12244
2000-02-17
 
12245
2002-02-15
 
12246
2004-05-25
 
12247
select * from t3 order by col1;
 
12248
col1
 
12249
2000-02-17
 
12250
2002-02-15
 
12251
2004-05-25
 
12252
select * from t4 order by colint;
 
12253
colint  col1
 
12254
1       2006-02-03
 
12255
2       2006-01-17
 
12256
3       2006-01-25
 
12257
4       2006-02-05
 
12258
60      2000-02-17
 
12259
select * from t5 order by colint;
 
12260
colint  col1
 
12261
1       2006-02-03
 
12262
2       2006-01-17
 
12263
3       2006-01-25
 
12264
4       2006-02-05
 
12265
60      2000-02-17
 
12266
select * from t6 order by colint;
 
12267
colint  col1
 
12268
1       2006-02-03
 
12269
2       2006-01-17
 
12270
3       2006-01-25
 
12271
4       2006-02-05
 
12272
60      2000-02-17
 
12273
alter table t1 drop partition p0;
 
12274
alter table t2 drop partition p0;
 
12275
alter table t4 drop partition p0;
 
12276
alter table t5 drop partition p0;
 
12277
alter table t6 drop partition p0;
 
12278
select * from t1 order by col1;
 
12279
col1
 
12280
select * from t2 order by col1;
 
12281
col1
 
12282
2002-02-15
 
12283
2004-05-25
 
12284
select * from t3 order by col1;
 
12285
col1
 
12286
2000-02-17
 
12287
2002-02-15
 
12288
2004-05-25
 
12289
select * from t4 order by colint;
 
12290
colint  col1
 
12291
60      2000-02-17
 
12292
select * from t5 order by colint;
 
12293
colint  col1
 
12294
60      2000-02-17
 
12295
select * from t6 order by colint;
 
12296
colint  col1
 
12297
60      2000-02-17
 
12298
-------------------------------------------------------------------------
 
12299
---  Delete rows and partitions of tables with year(col1)-1990
 
12300
-------------------------------------------------------------------------
 
12301
delete from t11 where col1='2000-02-17';
 
12302
delete from t22 where col1='2000-02-17';
 
12303
delete from t33 where col1='2000-02-17';
 
12304
delete from t44 where col1='2000-02-17';
 
12305
delete from t55 where col1='2000-02-17';
 
12306
delete from t66 where col1='2000-02-17';
 
12307
select * from t11 order by col1;
 
12308
col1
 
12309
2002-02-15
 
12310
select * from t22 order by col1;
 
12311
col1
 
12312
2002-02-15
 
12313
2004-05-25
 
12314
select * from t33 order by col1;
 
12315
col1
 
12316
2002-02-15
 
12317
2004-05-25
 
12318
select * from t44 order by colint;
 
12319
colint  col1
 
12320
1       2006-02-03
 
12321
2       2006-01-17
 
12322
3       2006-01-25
 
12323
4       2006-02-05
 
12324
select * from t55 order by colint;
 
12325
colint  col1
 
12326
1       2006-02-03
 
12327
2       2006-01-17
 
12328
3       2006-01-25
 
12329
4       2006-02-05
 
12330
insert into t11 values ('2000-02-17');
 
12331
insert into t22 values ('2000-02-17');
 
12332
insert into t33 values ('2000-02-17');
 
12333
insert into t44 values (60,'2000-02-17');
 
12334
insert into t55 values (60,'2000-02-17');
 
12335
insert into t66 values (60,'2000-02-17');
 
12336
select * from t11 order by col1;
 
12337
col1
 
12338
2000-02-17
 
12339
2002-02-15
 
12340
select * from t22 order by col1;
 
12341
col1
 
12342
2000-02-17
 
12343
2002-02-15
 
12344
2004-05-25
 
12345
select * from t33 order by col1;
 
12346
col1
 
12347
2000-02-17
 
12348
2002-02-15
 
12349
2004-05-25
 
12350
select * from t44 order by colint;
 
12351
colint  col1
 
12352
1       2006-02-03
 
12353
2       2006-01-17
 
12354
3       2006-01-25
 
12355
4       2006-02-05
 
12356
60      2000-02-17
 
12357
select * from t55 order by colint;
 
12358
colint  col1
 
12359
1       2006-02-03
 
12360
2       2006-01-17
 
12361
3       2006-01-25
 
12362
4       2006-02-05
 
12363
60      2000-02-17
 
12364
select * from t66 order by colint;
 
12365
colint  col1
 
12366
1       2006-02-03
 
12367
2       2006-01-17
 
12368
3       2006-01-25
 
12369
4       2006-02-05
 
12370
60      2000-02-17
 
12371
alter table t11 drop partition p0;
 
12372
alter table t22 drop partition p0;
 
12373
alter table t44 drop partition p0;
 
12374
alter table t55 drop partition p0;
 
12375
alter table t66 drop partition p0;
 
12376
select * from t11 order by col1;
 
12377
col1
 
12378
select * from t22 order by col1;
 
12379
col1
 
12380
2002-02-15
 
12381
2004-05-25
 
12382
select * from t33 order by col1;
 
12383
col1
 
12384
2000-02-17
 
12385
2002-02-15
 
12386
2004-05-25
 
12387
select * from t44 order by colint;
 
12388
colint  col1
 
12389
60      2000-02-17
 
12390
select * from t55 order by colint;
 
12391
colint  col1
 
12392
60      2000-02-17
 
12393
select * from t66 order by colint;
 
12394
colint  col1
 
12395
60      2000-02-17
 
12396
-------------------------
 
12397
---- some alter table end
 
12398
-------------------------
 
12399
drop table if exists t1 ;
 
12400
drop table if exists t2 ;
 
12401
drop table if exists t3 ;
 
12402
drop table if exists t4 ;
 
12403
drop table if exists t5 ;
 
12404
drop table if exists t6 ;
 
12405
drop table if exists t11 ;
 
12406
drop table if exists t22 ;
 
12407
drop table if exists t33 ;
 
12408
drop table if exists t44 ;
 
12409
drop table if exists t55 ;
 
12410
drop table if exists t66 ;
 
12411
-------------------------------------------------------------------------
 
12412
---  yearweek(col1)-200600  in partition with coltype  date
 
12413
-------------------------------------------------------------------------
 
12414
drop table if exists t1 ;
 
12415
drop table if exists t2 ;
 
12416
drop table if exists t3 ;
 
12417
drop table if exists t4 ;
 
12418
drop table if exists t5 ;
 
12419
drop table if exists t6 ;
 
12420
-------------------------------------------------------------------------
 
12421
---  Create tables with yearweek(col1)-200600
 
12422
-------------------------------------------------------------------------
 
12423
create table t1 (col1 date) engine='MYISAM' 
 
12424
partition by range(yearweek(col1)-200600) 
 
12425
(partition p0 values less than (15),
 
12426
partition p1 values less than maxvalue);
 
12427
create table t2 (col1 date) engine='MYISAM' 
 
12428
partition by list(yearweek(col1)-200600) 
 
12429
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
12430
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
12431
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
12432
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
12433
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
12434
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
12435
);
 
12436
create table t3 (col1 date) engine='MYISAM' 
 
12437
partition by hash(yearweek(col1)-200600);
 
12438
create table t4 (colint int, col1 date) engine='MYISAM' 
 
12439
partition by range(colint) 
 
12440
subpartition by hash(yearweek(col1)-200600) subpartitions 2 
 
12441
(partition p0 values less than (15),
 
12442
partition p1 values less than maxvalue);
 
12443
create table t5 (colint int, col1 date) engine='MYISAM' 
 
12444
partition by list(colint)
 
12445
subpartition by hash(yearweek(col1)-200600) subpartitions 2 
 
12446
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
12447
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
12448
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
12449
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
12450
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
12451
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
12452
);
 
12453
create table t6 (colint int, col1 date) engine='MYISAM' 
 
12454
partition by range(colint) 
 
12455
(partition p0 values less than (yearweek('2006-10-14')-200600),
 
12456
partition p1 values less than maxvalue);
 
12457
-------------------------------------------------------------------------
 
12458
---  Access tables with yearweek(col1)-200600 
 
12459
-------------------------------------------------------------------------
 
12460
insert into t1 values ('2006-01-03');
 
12461
insert into t1 values ('2006-08-17');
 
12462
insert into t2 values ('2006-01-03');
 
12463
insert into t2 values ('2006-08-17');
 
12464
insert into t2 values ('2006-03-25');
 
12465
insert into t3 values ('2006-01-03');
 
12466
insert into t3 values ('2006-08-17');
 
12467
insert into t3 values ('2006-03-25');
 
12468
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
 
12469
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
 
12470
load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
 
12471
select yearweek(col1)-200600 from t1 order by col1;
 
12472
yearweek(col1)-200600
 
12473
1
 
12474
33
 
12475
select * from t1 order by col1;
 
12476
col1
 
12477
2006-01-03
 
12478
2006-08-17
 
12479
select * from t2 order by col1;
 
12480
col1
 
12481
2006-01-03
 
12482
2006-03-25
 
12483
2006-08-17
 
12484
select * from t3 order by col1;
 
12485
col1
 
12486
2006-01-03
 
12487
2006-03-25
 
12488
2006-08-17
 
12489
select * from t4 order by colint;
 
12490
colint  col1
 
12491
1       2006-02-03
 
12492
2       2006-01-17
 
12493
3       2006-01-25
 
12494
4       2006-02-05
 
12495
select * from t5 order by colint;
 
12496
colint  col1
 
12497
1       2006-02-03
 
12498
2       2006-01-17
 
12499
3       2006-01-25
 
12500
4       2006-02-05
 
12501
select * from t6 order by colint;
 
12502
colint  col1
 
12503
1       2006-02-03
 
12504
2       2006-01-17
 
12505
3       2006-01-25
 
12506
4       2006-02-05
 
12507
update t1 set col1='2006-11-15' where col1='2006-01-03';
 
12508
update t2 set col1='2006-11-15' where col1='2006-01-03';
 
12509
update t3 set col1='2006-11-15' where col1='2006-01-03';
 
12510
update t4 set col1='2006-11-15' where col1='2006-01-03';
 
12511
update t5 set col1='2006-11-15' where col1='2006-01-03';
 
12512
update t6 set col1='2006-11-15' where col1='2006-01-03';
 
12513
select * from t1 order by col1;
 
12514
col1
 
12515
2006-08-17
 
12516
2006-11-15
 
12517
select * from t2 order by col1;
 
12518
col1
 
12519
2006-03-25
 
12520
2006-08-17
 
12521
2006-11-15
 
12522
select * from t3 order by col1;
 
12523
col1
 
12524
2006-03-25
 
12525
2006-08-17
 
12526
2006-11-15
 
12527
select * from t4 order by colint;
 
12528
colint  col1
 
12529
1       2006-02-03
 
12530
2       2006-01-17
 
12531
3       2006-01-25
 
12532
4       2006-02-05
 
12533
select * from t5 order by colint;
 
12534
colint  col1
 
12535
1       2006-02-03
 
12536
2       2006-01-17
 
12537
3       2006-01-25
 
12538
4       2006-02-05
 
12539
select * from t6 order by colint;
 
12540
colint  col1
 
12541
1       2006-02-03
 
12542
2       2006-01-17
 
12543
3       2006-01-25
 
12544
4       2006-02-05
 
12545
-------------------------------------------------------------------------
 
12546
---  Alter tables with yearweek(col1)-200600
 
12547
-------------------------------------------------------------------------
 
12548
drop table if exists t11 ;
 
12549
drop table if exists t22 ;
 
12550
drop table if exists t33 ;
 
12551
drop table if exists t44 ;
 
12552
drop table if exists t55 ;
 
12553
drop table if exists t66 ;
 
12554
create table t11 engine='MYISAM' as select * from t1;
 
12555
create table t22 engine='MYISAM' as select * from t2;
 
12556
create table t33 engine='MYISAM' as select * from t3;
 
12557
create table t44 engine='MYISAM' as select * from t4;
 
12558
create table t55 engine='MYISAM' as select * from t5;
 
12559
create table t66 engine='MYISAM' as select * from t6;
 
12560
alter table t11
 
12561
partition by range(yearweek(col1)-200600) 
 
12562
(partition p0 values less than (15),
 
12563
partition p1 values less than maxvalue);
 
12564
alter table t22
 
12565
partition by list(yearweek(col1)-200600) 
 
12566
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
12567
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
12568
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
12569
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
12570
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
12571
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
12572
);
 
12573
alter table t33
 
12574
partition by hash(yearweek(col1)-200600);
 
12575
alter table t44
 
12576
partition by range(colint) 
 
12577
subpartition by hash(yearweek(col1)-200600) subpartitions 2 
 
12578
(partition p0 values less than (15),
 
12579
partition p1 values less than maxvalue);
 
12580
alter table t55
 
12581
partition by list(colint)
 
12582
subpartition by hash(yearweek(col1)-200600) subpartitions 2 
 
12583
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
12584
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
12585
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
12586
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
12587
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
12588
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
12589
);
 
12590
alter table t66
 
12591
partition by range(colint) 
 
12592
(partition p0 values less than (yearweek('2006-10-14')-200600),
 
12593
partition p1 values less than maxvalue);
 
12594
select * from t11 order by col1;
 
12595
col1
 
12596
2006-08-17
 
12597
2006-11-15
 
12598
select * from t22 order by col1;
 
12599
col1
 
12600
2006-03-25
 
12601
2006-08-17
 
12602
2006-11-15
 
12603
select * from t33 order by col1;
 
12604
col1
 
12605
2006-03-25
 
12606
2006-08-17
 
12607
2006-11-15
 
12608
select * from t44 order by colint;
 
12609
colint  col1
 
12610
1       2006-02-03
 
12611
2       2006-01-17
 
12612
3       2006-01-25
 
12613
4       2006-02-05
 
12614
select * from t55 order by colint;
 
12615
colint  col1
 
12616
1       2006-02-03
 
12617
2       2006-01-17
 
12618
3       2006-01-25
 
12619
4       2006-02-05
 
12620
select * from t66 order by colint;
 
12621
colint  col1
 
12622
1       2006-02-03
 
12623
2       2006-01-17
 
12624
3       2006-01-25
 
12625
4       2006-02-05
 
12626
---------------------------
 
12627
---- some alter table begin
 
12628
---------------------------
 
12629
alter table t11
 
12630
reorganize partition p0,p1 into
 
12631
(partition s1 values less than maxvalue);
 
12632
select * from t11 order by col1;
 
12633
col1
 
12634
2006-08-17
 
12635
2006-11-15
 
12636
alter table t11
 
12637
reorganize partition s1 into
 
12638
(partition p0 values less than (15),
 
12639
partition p1 values less than maxvalue);
 
12640
select * from t11 order by col1;
 
12641
col1
 
12642
2006-08-17
 
12643
2006-11-15
 
12644
alter table t55
 
12645
partition by list(colint)
 
12646
subpartition by hash(yearweek(col1)-200600) subpartitions 5 
 
12647
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
12648
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
12649
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
12650
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
12651
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
12652
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
12653
);
 
12654
show create table t55;
 
12655
Table   Create Table
 
12656
t55     CREATE TABLE `t55` (
 
12657
  `colint` int(11) DEFAULT NULL,
 
12658
  `col1` date DEFAULT NULL
 
12659
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (yearweek(col1)-200600) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
 
12660
select * from t55 order by colint;
 
12661
colint  col1
 
12662
1       2006-02-03
 
12663
2       2006-01-17
 
12664
3       2006-01-25
 
12665
4       2006-02-05
 
12666
alter table t66
 
12667
reorganize partition p0,p1 into
 
12668
(partition s1 values less than maxvalue);
 
12669
select * from t66 order by colint;
 
12670
colint  col1
 
12671
1       2006-02-03
 
12672
2       2006-01-17
 
12673
3       2006-01-25
 
12674
4       2006-02-05
 
12675
alter table t66
 
12676
reorganize partition s1 into
 
12677
(partition p0 values less than (yearweek('2006-10-14')-200600),
 
12678
partition p1 values less than maxvalue);
 
12679
select * from t66 order by colint;
 
12680
colint  col1
 
12681
1       2006-02-03
 
12682
2       2006-01-17
 
12683
3       2006-01-25
 
12684
4       2006-02-05
 
12685
alter table t66
 
12686
reorganize partition p0,p1 into
 
12687
(partition s1 values less than maxvalue);
 
12688
select * from t66 order by colint;
 
12689
colint  col1
 
12690
1       2006-02-03
 
12691
2       2006-01-17
 
12692
3       2006-01-25
 
12693
4       2006-02-05
 
12694
alter table t66
 
12695
reorganize partition s1 into
 
12696
(partition p0 values less than (yearweek('2006-10-14')-200600),
 
12697
partition p1 values less than maxvalue);
 
12698
select * from t66 order by colint;
 
12699
colint  col1
 
12700
1       2006-02-03
 
12701
2       2006-01-17
 
12702
3       2006-01-25
 
12703
4       2006-02-05
 
12704
-------------------------------------------------------------------------
 
12705
---  Delete rows and partitions of tables with yearweek(col1)-200600
 
12706
-------------------------------------------------------------------------
 
12707
delete from t1 where col1='2006-08-17';
 
12708
delete from t2 where col1='2006-08-17';
 
12709
delete from t3 where col1='2006-08-17';
 
12710
delete from t4 where col1='2006-08-17';
 
12711
delete from t5 where col1='2006-08-17';
 
12712
delete from t6 where col1='2006-08-17';
 
12713
select * from t1 order by col1;
 
12714
col1
 
12715
2006-11-15
 
12716
select * from t2 order by col1;
 
12717
col1
 
12718
2006-03-25
 
12719
2006-11-15
 
12720
select * from t3 order by col1;
 
12721
col1
 
12722
2006-03-25
 
12723
2006-11-15
 
12724
select * from t4 order by colint;
 
12725
colint  col1
 
12726
1       2006-02-03
 
12727
2       2006-01-17
 
12728
3       2006-01-25
 
12729
4       2006-02-05
 
12730
select * from t5 order by colint;
 
12731
colint  col1
 
12732
1       2006-02-03
 
12733
2       2006-01-17
 
12734
3       2006-01-25
 
12735
4       2006-02-05
 
12736
insert into t1 values ('2006-08-17');
 
12737
insert into t2 values ('2006-08-17');
 
12738
insert into t3 values ('2006-08-17');
 
12739
insert into t4 values (60,'2006-08-17');
 
12740
insert into t5 values (60,'2006-08-17');
 
12741
insert into t6 values (60,'2006-08-17');
 
12742
select * from t1 order by col1;
 
12743
col1
 
12744
2006-08-17
 
12745
2006-11-15
 
12746
select * from t2 order by col1;
 
12747
col1
 
12748
2006-03-25
 
12749
2006-08-17
 
12750
2006-11-15
 
12751
select * from t3 order by col1;
 
12752
col1
 
12753
2006-03-25
 
12754
2006-08-17
 
12755
2006-11-15
 
12756
select * from t4 order by colint;
 
12757
colint  col1
 
12758
1       2006-02-03
 
12759
2       2006-01-17
 
12760
3       2006-01-25
 
12761
4       2006-02-05
 
12762
60      2006-08-17
 
12763
select * from t5 order by colint;
 
12764
colint  col1
 
12765
1       2006-02-03
 
12766
2       2006-01-17
 
12767
3       2006-01-25
 
12768
4       2006-02-05
 
12769
60      2006-08-17
 
12770
select * from t6 order by colint;
 
12771
colint  col1
 
12772
1       2006-02-03
 
12773
2       2006-01-17
 
12774
3       2006-01-25
 
12775
4       2006-02-05
 
12776
60      2006-08-17
 
12777
alter table t1 drop partition p0;
 
12778
alter table t2 drop partition p0;
 
12779
alter table t4 drop partition p0;
 
12780
alter table t5 drop partition p0;
 
12781
alter table t6 drop partition p0;
 
12782
select * from t1 order by col1;
 
12783
col1
 
12784
2006-08-17
 
12785
2006-11-15
 
12786
select * from t2 order by col1;
 
12787
col1
 
12788
2006-03-25
 
12789
2006-08-17
 
12790
2006-11-15
 
12791
select * from t3 order by col1;
 
12792
col1
 
12793
2006-03-25
 
12794
2006-08-17
 
12795
2006-11-15
 
12796
select * from t4 order by colint;
 
12797
colint  col1
 
12798
60      2006-08-17
 
12799
select * from t5 order by colint;
 
12800
colint  col1
 
12801
60      2006-08-17
 
12802
select * from t6 order by colint;
 
12803
colint  col1
 
12804
60      2006-08-17
 
12805
-------------------------------------------------------------------------
 
12806
---  Delete rows and partitions of tables with yearweek(col1)-200600
 
12807
-------------------------------------------------------------------------
 
12808
delete from t11 where col1='2006-08-17';
 
12809
delete from t22 where col1='2006-08-17';
 
12810
delete from t33 where col1='2006-08-17';
 
12811
delete from t44 where col1='2006-08-17';
 
12812
delete from t55 where col1='2006-08-17';
 
12813
delete from t66 where col1='2006-08-17';
 
12814
select * from t11 order by col1;
 
12815
col1
 
12816
2006-11-15
 
12817
select * from t22 order by col1;
 
12818
col1
 
12819
2006-03-25
 
12820
2006-11-15
 
12821
select * from t33 order by col1;
 
12822
col1
 
12823
2006-03-25
 
12824
2006-11-15
 
12825
select * from t44 order by colint;
 
12826
colint  col1
 
12827
1       2006-02-03
 
12828
2       2006-01-17
 
12829
3       2006-01-25
 
12830
4       2006-02-05
 
12831
select * from t55 order by colint;
 
12832
colint  col1
 
12833
1       2006-02-03
 
12834
2       2006-01-17
 
12835
3       2006-01-25
 
12836
4       2006-02-05
 
12837
insert into t11 values ('2006-08-17');
 
12838
insert into t22 values ('2006-08-17');
 
12839
insert into t33 values ('2006-08-17');
 
12840
insert into t44 values (60,'2006-08-17');
 
12841
insert into t55 values (60,'2006-08-17');
 
12842
insert into t66 values (60,'2006-08-17');
 
12843
select * from t11 order by col1;
 
12844
col1
 
12845
2006-08-17
 
12846
2006-11-15
 
12847
select * from t22 order by col1;
 
12848
col1
 
12849
2006-03-25
 
12850
2006-08-17
 
12851
2006-11-15
 
12852
select * from t33 order by col1;
 
12853
col1
 
12854
2006-03-25
 
12855
2006-08-17
 
12856
2006-11-15
 
12857
select * from t44 order by colint;
 
12858
colint  col1
 
12859
1       2006-02-03
 
12860
2       2006-01-17
 
12861
3       2006-01-25
 
12862
4       2006-02-05
 
12863
60      2006-08-17
 
12864
select * from t55 order by colint;
 
12865
colint  col1
 
12866
1       2006-02-03
 
12867
2       2006-01-17
 
12868
3       2006-01-25
 
12869
4       2006-02-05
 
12870
60      2006-08-17
 
12871
select * from t66 order by colint;
 
12872
colint  col1
 
12873
1       2006-02-03
 
12874
2       2006-01-17
 
12875
3       2006-01-25
 
12876
4       2006-02-05
 
12877
60      2006-08-17
 
12878
alter table t11 drop partition p0;
 
12879
alter table t22 drop partition p0;
 
12880
alter table t44 drop partition p0;
 
12881
alter table t55 drop partition p0;
 
12882
alter table t66 drop partition p0;
 
12883
select * from t11 order by col1;
 
12884
col1
 
12885
2006-08-17
 
12886
2006-11-15
 
12887
select * from t22 order by col1;
 
12888
col1
 
12889
2006-03-25
 
12890
2006-08-17
 
12891
2006-11-15
 
12892
select * from t33 order by col1;
 
12893
col1
 
12894
2006-03-25
 
12895
2006-08-17
 
12896
2006-11-15
 
12897
select * from t44 order by colint;
 
12898
colint  col1
 
12899
60      2006-08-17
 
12900
select * from t55 order by colint;
 
12901
colint  col1
 
12902
60      2006-08-17
 
12903
select * from t66 order by colint;
 
12904
colint  col1
 
12905
60      2006-08-17
 
12906
-------------------------
 
12907
---- some alter table end
 
12908
-------------------------
 
12909
drop table if exists t1 ;
 
12910
drop table if exists t2 ;
 
12911
drop table if exists t3 ;
 
12912
drop table if exists t4 ;
 
12913
drop table if exists t5 ;
 
12914
drop table if exists t6 ;
 
12915
drop table if exists t11 ;
 
12916
drop table if exists t22 ;
 
12917
drop table if exists t33 ;
 
12918
drop table if exists t44 ;
 
12919
drop table if exists t55 ;
 
12920
drop table if exists t66 ;