| 1 |
create table t1 (a float 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` float 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 (-3.402823466E+38), (3.402823466E+38), (-1.5), (-1), (0), (1), (1.5); |
| 19 |
select * from t1; |
| 20 |
a |
| 21 |
0 |
| 22 |
-3.40282e38 |
| 23 |
-1.5 |
| 24 |
-1 |
| 25 |
1 |
| 26 |
1.5 |
| 27 |
3.40282e38 |
| 28 |
select * from t1 where a=1.5; |
| 29 |
a |
| 30 |
1.5 |
| 31 |
delete from t1 where a=1.5; |
| 32 |
select * from t1; |
| 33 |
a |
| 34 |
0 |
| 35 |
-3.40282e38 |
| 36 |
-1.5 |
| 37 |
-1 |
| 38 |
1 |
| 39 |
3.40282e38 |
| 40 |
drop table t1; |
| 41 |
create table t2 (a float not null, primary key(a)) engine='InnoDB' |
| 42 |
partition by key (a) partitions 10; |
| 43 |
show create table t2; |
| 44 |
Table Create Table |
| 45 |
t2 CREATE TABLE `t2` ( |
| 46 |
`a` float NOT NULL, |
| 47 |
PRIMARY KEY (`a`) |
| 48 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 49 |
PARTITION BY KEY (`a`) |
| 50 |
PARTITIONS 10 |
| 51 |
insert into t2 values (-3.402823466E+38), (-3.402823466E+37), (-123.456), (0), (1234546.789), (123.456), (1.5); |
| 52 |
select * from t2; |
| 53 |
a |
| 54 |
0 |
| 55 |
-3.40282e38 |
| 56 |
-3.40282e37 |
| 57 |
-123.456 |
| 58 |
1.5 |
| 59 |
123.456 |
| 60 |
1234550 |
| 61 |
select * from t2 where a=123.456; |
| 62 |
a |
| 63 |
delete from t2 where a=123.456; |
| 64 |
select * from t2; |
| 65 |
a |
| 66 |
0 |
| 67 |
-3.40282e38 |
| 68 |
-3.40282e37 |
| 69 |
-123.456 |
| 70 |
1.5 |
| 71 |
123.456 |
| 72 |
1234550 |
| 73 |
select * from t2 where a=1.5; |
| 74 |
a |
| 75 |
1.5 |
| 76 |
delete from t2 where a=1.5; |
| 77 |
select * from t2; |
| 78 |
a |
| 79 |
0 |
| 80 |
-3.40282e38 |
| 81 |
-3.40282e37 |
| 82 |
-123.456 |
| 83 |
123.456 |
| 84 |
1234550 |
| 85 |
delete from t2; |
| 86 |
1024*3 inserts; |
| 87 |
select count(*) from t2; |
| 88 |
count(*) |
| 89 |
3072 |
| 90 |
drop table t2; |