MySQL分区

1.查询已有分区

select 
  partition_name part,  
  partition_expression expr,  
  partition_description descr,  
  table_rows  
from information_schema.partitions  where 
  table_schema = schema()  
  and table_name='表名';  

 

2.删除分区

alter table 表名 drop partition 分区名;
//例如
alter table tbUUWiFiSession drop partition p20190625;

 

3.添加分区

 ALTER TABLE 表名 ADD PARTITION (PARTITION 分区名 VALUES less than (条件) ENGINE = InnoDB);

//例如
 ALTER TABLE tbUUWiFiSession ADD PARTITION (PARTITION p20190626 VALUES less than (20190627) ENGINE = InnoDB);

 4.清空分区数据

 alter table tbXXX truncate partition p20210106;  

 

posted @ 2019-06-26 15:50  一个九  阅读(234)  评论(0编辑  收藏  举报