直接用变通的查询方式,查询时间高的吓人,因为有些数据查询是不连贯的,不能用大于多少或等于多少来查询; [sql] => SELECT * FROM `article_comments` ORDER BY id DESC LIMIT 199980, 20; [time] => 0.438656 [sql] => SELECT * FROM `article_comments` ORDER BY id DESC LIMIT 1999980, 20; [time] => 26.835051 [sql] => SELECT * FROM `article_comments` ORDER BY id DESC LIMIT 19999980, 20; [time] => 31.343988 [sql] => SELECT * FROM `article_comments` ORDER BY id DESC LIMIT 29999980, 20; [time] => 32.138655
现在的做法是通过先查询取出 id SELECT id FROM `article_comments` LIMIT 19999980, 20;
然后用 id 去取数据 SELECT * FROM `article_comments` WHERE id IN('1','2'....); 虽然这样优化了很多,但是也不是很理想,如果取的 ID 间隔大,也会进行全表扫描; 看 V2 能人很多,不知道还有没更优化的方法?