| 1 |
create table t1 (a mediumint unsigned not null, primary key(a)) engine='MYISAM' |
| 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 |
Table Create Table |
| 9 |
t1 CREATE TABLE `t1` ( |
| 10 |
`a` mediumint(8) unsigned NOT NULL, |
| 11 |
PRIMARY KEY (`a`) |
| 12 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 13 |
PARTITION BY KEY (`a`) |
| 14 |
(PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, |
| 15 |
PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, |
| 16 |
PARTITION `pa3` MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, |
| 17 |
PARTITION `pa4` MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) |
| 18 |
insert into t1 values (16777215), (16777214), (16777213), (16777212), (1), (2), (65535); |
| 19 |
select * from t1; |
| 20 |
a |
| 21 |
1 |
| 22 |
16777212 |
| 23 |
16777213 |
| 24 |
16777214 |
| 25 |
16777215 |
| 26 |
2 |
| 27 |
65535 |
| 28 |
select * from t1 where a=16777213; |
| 29 |
a |
| 30 |
16777213 |
| 31 |
delete from t1 where a=16777213; |
| 32 |
select * from t1; |
| 33 |
a |
| 34 |
1 |
| 35 |
16777212 |
| 36 |
16777214 |
| 37 |
16777215 |
| 38 |
2 |
| 39 |
65535 |
| 40 |
drop table t1; |
| 41 |
create table t2 (a mediumint unsigned not null, primary key(a)) engine='MYISAM' |
| 42 |
partition by key (a) partitions 8; |
| 43 |
show create table t2; |
| 44 |
Table Create Table |
| 45 |
t2 CREATE TABLE `t2` ( |
| 46 |
`a` mediumint(8) unsigned NOT NULL, |
| 47 |
PRIMARY KEY (`a`) |
| 48 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 49 |
PARTITION BY KEY (`a`) |
| 50 |
PARTITIONS 8 |
| 51 |
insert into t2 values (16777215), (16777214), (16777213), (16777212); |
| 52 |
select * from t2; |
| 53 |
a |
| 54 |
16777212 |
| 55 |
16777213 |
| 56 |
16777214 |
| 57 |
16777215 |
| 58 |
select * from t2 where a=16777213; |
| 59 |
a |
| 60 |
16777213 |
| 61 |
delete from t2 where a=16777213; |
| 62 |
select * from t2; |
| 63 |
a |
| 64 |
16777212 |
| 65 |
16777214 |
| 66 |
16777215 |
| 67 |
delete from t2; |
| 68 |
65535 inserts; |
| 69 |
select count(*) from t2; |
| 70 |
count(*) |
| 71 |
65535 |
| 72 |
drop table t2; |
| 73 |
create table t3 (a mediumint not null, primary key(a)) engine='MYISAM' |
| 74 |
partition by key (a) partitions 7; |
| 75 |
show create table t3; |
| 76 |
Table Create Table |
| 77 |
t3 CREATE TABLE `t3` ( |
| 78 |
`a` mediumint(9) NOT NULL, |
| 79 |
PRIMARY KEY (`a`) |
| 80 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 81 |
PARTITION BY KEY (`a`) |
| 82 |
PARTITIONS 7 |
| 83 |
insert into t3 values (8388607), (8388606), (8388605), (8388604), (-8388608), (-8388607), (1), (-1), (0); |
| 84 |
select * from t3; |
| 85 |
a |
| 86 |
-1 |
| 87 |
-8388607 |
| 88 |
-8388608 |
| 89 |
0 |
| 90 |
1 |
| 91 |
8388604 |
| 92 |
8388605 |
| 93 |
8388606 |
| 94 |
8388607 |
| 95 |
select * from t3 where a=8388605; |
| 96 |
a |
| 97 |
8388605 |
| 98 |
delete from t3 where a=8388605; |
| 99 |
select * from t3; |
| 100 |
a |
| 101 |
-1 |
| 102 |
-8388607 |
| 103 |
-8388608 |
| 104 |
0 |
| 105 |
1 |
| 106 |
8388604 |
| 107 |
8388606 |
| 108 |
8388607 |
| 109 |
drop table t3; |