| 1 |
create table t1 (a double not null, primary key(a)) engine='InnoDB' |
| 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` double NOT NULL, |
| 11 |
PRIMARY KEY (`a`) |
| 12 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 13 |
PARTITION BY KEY (`a`) |
| 14 |
(PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, |
| 15 |
PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, |
| 16 |
PARTITION `pa3` MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, |
| 17 |
PARTITION `pa4` MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) |
| 18 |
insert into t1 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208); |
| 19 |
select * from t1; |
| 20 |
a |
| 21 |
-1 |
| 22 |
-1.5 |
| 23 |
-2.2250738585072014e-208 |
| 24 |
-2.2250738585072016e208 |
| 25 |
0 |
| 26 |
1.5 |
| 27 |
1234.567 |
| 28 |
2.2250738585072016e208 |
| 29 |
select * from t1 where a=1.5; |
| 30 |
a |
| 31 |
1.5 |
| 32 |
delete from t1 where a=1.5; |
| 33 |
select * from t1; |
| 34 |
a |
| 35 |
-1 |
| 36 |
-1.5 |
| 37 |
-2.2250738585072014e-208 |
| 38 |
-2.2250738585072016e208 |
| 39 |
0 |
| 40 |
1234.567 |
| 41 |
2.2250738585072016e208 |
| 42 |
drop table t1; |
| 43 |
create table t2 (a double not null, primary key(a)) engine='InnoDB' |
| 44 |
partition by key (a) partitions 10; |
| 45 |
show create table t2; |
| 46 |
Table Create Table |
| 47 |
t2 CREATE TABLE `t2` ( |
| 48 |
`a` double NOT NULL, |
| 49 |
PRIMARY KEY (`a`) |
| 50 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 51 |
PARTITION BY KEY (`a`) |
| 52 |
PARTITIONS 10 |
| 53 |
insert into t2 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208); |
| 54 |
select * from t2; |
| 55 |
a |
| 56 |
-1 |
| 57 |
-1.5 |
| 58 |
-2.2250738585072014e-208 |
| 59 |
-2.2250738585072016e208 |
| 60 |
0 |
| 61 |
1.5 |
| 62 |
1234.567 |
| 63 |
2.2250738585072016e208 |
| 64 |
select * from t2 where a=1234.567; |
| 65 |
a |
| 66 |
1234.567 |
| 67 |
delete from t2 where a=1234.567; |
| 68 |
select * from t2; |
| 69 |
a |
| 70 |
-1 |
| 71 |
-1.5 |
| 72 |
-2.2250738585072014e-208 |
| 73 |
-2.2250738585072016e208 |
| 74 |
0 |
| 75 |
1.5 |
| 76 |
2.2250738585072016e208 |
| 77 |
delete from t2; |
| 78 |
1024*3 inserts; |
| 79 |
select count(*) from t2; |
| 80 |
count(*) |
| 81 |
3072 |
| 82 |
drop table t2; |