explain select * from table_name limit 10000,20; explain select * from table_name limit 10000,20 order by id desc; explain select * from table_name where item_id = 1 limit 10000,20;
挨个执行看看,你还需要花 20 分钟研究一下索引到底是什么
rqrq
2016-04-06 14:48:28 +08:00
先加上 order by id desc 试试,还是不行试试: select * from table_name where id < (select min(id) from (select id from table_name order by id desc limit 10000) as tmp) limit 20
msg7086
2016-04-06 14:50:42 +08:00
MySQL 的分页是先读再丢,所以应该要读了扔了 10 万条记录以后再返回。 我自己是先读 ID 然后再用 ID IN () 去查表返回的。