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

# 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'

 

相关文章:

  • 2021-07-20
  • 2022-12-23
  • 2022-03-01
  • 2021-12-27
  • 2021-11-12
  • 2021-11-30
  • 2021-11-30
  • 2021-12-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2021-11-30
  • 2021-11-30
  • 2021-11-30
相关资源
相似解决方案