桌子:
CREATE TABLE `test` (
`uid` int(11) unsigned NOT NULL AUTO_INCREMENT,
`rating` smallint(5) unsigned NOT NULL DEFAULT '100',
PRIMARY KEY (`uid`),
KEY `rating` (`rating`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
此查询运行得足够快(0.015 秒):
SELECT uid FROM test ORDER BY rating DESC LIMIT 0,100
但是由于 LIMIT 偏移量很大,它的运行速度非常慢(2.215 秒):
SELECT uid FROM test ORDER BY rating DESC LIMIT 10000,100
我怎样才能摆脱巨大的 LIMIT 偏移量?!