1. 复制表并且按照条件插入数据(此种方法除了主键索引不包括其他索引)
CREATE TABLE lime_survey_549656_20151001 as select * from lime_survey_549656 where submitdate < "2015-10-01 00:00:00";
ALTER TABLE lime_survey_549656_20151001 change id id int primary key auto_increment;
2. 数据归档成功后清理数据sql
deletefrom lime_survey_549656 where submitdate < "2015-10-0100:00:00";
网友评论