MySQL 5.5 range分区增加删除处理的方法示例
发布时间:2018-07-24 来源:查字典编辑
摘要:一、删除分区##查看要处理的分区的数据量,并导出作为备份MySQL5.5range分区增加删除处理的方法示例mysql>selectcoun...
一、删除分区
##查看要处理的分区的数据量,并导出作为备份 MySQL 5.5 range分区增加删除处理的方法示例 mysql> select count(*) from baby_account_change_log where updated_time >'2016-12-01 00:00:00' and updated_time select * into outfile '/tmp/baby_account_change_log_p1.sql' from baby_account_change_log where updated_time >'2016-12-01 00:00:00' and updated_time explain partitions select count(*) from baby_account_change_log where updated_time >'2016-12-01 00:00:00' and updated_time alter table baby_account_change_log drop partition p0; Query OK, 0 rows affected (0.01 sec)二、增加分区
#错误提示删除存储最大值分区 mysql> alter table baby_account_change_log add partition(PARTITION p13 VALUES LESS THAN (unix_timestamp('2017-12-31 23:59:59'))); ERROR 1481 (HY000): MAXVALUE can only be used in last partition definition #删除存储最大值分区 mysql> alter table baby_account_change_log drop partition p12; ##增加新的分区 mysql> alter table baby_account_change_log add partition(PARTITION p12 VALUES LESS THAN (unix_