mysql分区总结
mysql分区总结
--range 分区
CREATE TABLE `t1` (
`record_id` bigint(20) ,
`province_code` varchar(50)
)PARTITION BY RANGE (record_id)
(
PARTITION P1 VALUES LESS THAN (10),
PARTITION P2 VALUES LESS THAN (100),
PARTITION P3 VALUES LESS THAN (1000)
);
select * from t1;
insert into t1 values(1,'aa');
insert into t1 values(50,'aa');
insert into t1 values(500,'aa');
select
partition_name part,
partition_expression expr,
partition_description descr,
table_rows
from information_schema.partitions where
table_schema = 'test'
and table_name='t1';
--range 分区
CREATE TABLE emp1 ( empno VARCHAR ( 20 ) NOT NULL, deptno INT)
PARTITION BY list ( deptno )
( PARTITION p1 VALUES IN ( 10 ), PARTITION p2 VALUES IN ( 20 ), PARTITION p3 VALUES IN ( 30 ) );
insert into emp1 values('01',10);
We only live once, and time just goes by.

浙公网安备 33010602011771号