记录一次统计首页MYSQL非常慢的解决过程


select resource_size_int from t_resource_info where release_status in (1,3) and res_type in (1,2,4,5) and resource_size_int>0 and GROUP_id=1 limit 0,1000

1、使用Python开发一个分页初始化的脚本,将目前的资源尺寸保存到一张表中,比如 t_res_sumarry_Table,按
limit 0,1000
limit 1001,2000
limit 2001,3000
进行分段提取,然后记录最后的ID和大小。

2、依赖于阿里Canal,对资源表的变化进行监控,然后重新加减此值。

原文地址:https://www.cnblogs.com/littlehb/p/7059657.html