解决数据量大,分页查询慢的方案

1、如果能确认id是自增且id不中断的情况下,可直接用id做limit的限制条件,例:select * from table limit #id#,100.

2、如果能确认id是自增且id不中断的情况下,先用子查询查出id,再用between,例:select * from table where id between 1000000 and 1000100 limit 100

3、用子查询,先把要开始查询的id查出来,再用limit,例:select * from table where id>(select id from table limit #pageNum#,#pageSize#) limit 100 

原文地址:https://www.cnblogs.com/3chi/p/13818973.html