Debian Codegraph @

mysql-test/suite/parts/inc/partition_time.inc

raw
1 eval create table t1 (a time not null, primary key(a)) engine=$engine
2 partition by key (a) (
3 partition pa1 max_rows=20 min_rows=2,
4 partition pa2 max_rows=30 min_rows=3,
5 partition pa3 max_rows=30 min_rows=4,
6 partition pa4 max_rows=40 min_rows=2);
7 show create table t1;
8 insert into t1 values ('21:21:21'), ('12:10:30'), ('03:03:03'), ('23:59');
9 select * from t1;
10 select * from t1 where a=030303;
11 delete from t1 where a=030303;
12 select * from t1;
13 drop table t1;
14
15 eval create table t2 (a time not null, primary key(a)) engine=$engine
16 partition by key (a) partitions 12;
17 show create table t2;
18 insert into t2 values ('0:1:1'), ('10:11:12'), ('13:14:15'), ('14:15:16');
19 select * from t2;
20 select * from t2 where a='13:14:15';
21 delete from t2 where a='13:14:15';
22 select * from t2;
23 delete from t2;
24 let $count=59;
25 --echo $count inserts;
26 --disable_query_log
27 begin;
28 while ($count)
29 {
30 eval insert into t2 values (000100+$count);
31 dec $count;
32 }
33 commit;
34 --enable_query_log
35 select count(*) from t2;
36 select * from t2;
37 drop table t2;
38
39 eval create table t3 (a time not null, primary key(a)) engine=$engine
40 partition by range (second(a)) subpartition by key (a)
41 subpartitions 3 (
42 partition quarter1 values less than (16),
43 partition quarter2 values less than (31),
44 partition quarter3 values less than (46),
45 partition quarter4 values less than (61)
46 );
47 show create table t3;
48 let $count=59;
49 --echo $count inserts;
50 --disable_query_log
51 begin;
52 while ($count)
53 {
54 eval insert into t3 values (100000+$count);
55 dec $count;
56 }
57 commit;
58 --enable_query_log
59 select count(*) from t3;
60 select a, second(a), if(second(a)<16,1,if(second(a)<31,2,if(second(a)<45,3,4))) from t3;
61 drop table t3;
62
63 eval create table t4 (a time not null, primary key(a)) engine=$engine
64 partition by list (second(a)) subpartition by key (a)
65 subpartitions 3 (
66 partition quarter1 values in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
67 partition quarter2 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
68 partition quarter3 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
69 partition quarter4 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
70 );
71 show create table t4;
72 let $count=59;
73 --echo $count inserts;
74 --disable_query_log
75 begin;
76 while ($count)
77 {
78 eval insert into t4 values (100000+$count);
79 dec $count;
80 }
81 commit;
82 --enable_query_log
83 select count(*) from t4;
84 select * from t4;
85 drop table t4;