求求你别再用offset和limit分页了

https://blog.csdn.net/weixin_44421461/article/details/112166878

 

比较这个查询:

select * from table_name limit 10 offset 8000001;

10 rows in set (12.80 sec)

和优化的版本:

select * from table_name where id > 8000000 limit 10;

10 rows in set (0.01 sec)

 

返回同样的结果,第一个查询使用了 12.80 秒,而第二个仅用了 0.01 秒。

posted on 2021-02-04 13:40  silyvin  阅读(88)  评论(0编辑  收藏  举报