由于单表量太大,导致性能问题

# 1 创建表
create table XXX_test like XXX;

# 2 转移数据
insert into XXX_test
select * from XXX where grasping_time>='2019-01-01 00:00:00' and grasping_time<'2020-01-01 00:00:00'

# 3 移除数据
delete from XXX where grasping_time>='2019-01-01 00:00:00' and grasping_time<'2020-01-01 00:00:00'

 

待处理记录 每次处理100W条

select count(1) from t_shopping_receipt_info where grasping_time<'2018-06-01 00:00:00'


select count(1) from t_shopping_receipt_info where grasping_time>='2018-06-01 00:00:00' and grasping_time<'2018-11-01 00:00:00'


select count(1) from t_shopping_receipt_info where grasping_time>='2018-11-01 00:00:00' and grasping_time<'2018-12-01 00:00:00'


select count(1) from t_shopping_receipt_info where grasping_time>='2018-12-01 00:00:00' and grasping_time<'2019-01-01 00:00:00'

 

posted on 2020-07-01 16:07  1161588342  阅读(1457)  评论(1编辑  收藏  举报