- 论坛徽章:
- 8
|
CREATE TABLE `test` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`b` int(11) NOT NULL,
`c` datetime NOT NULL,
`d` varchar(1000) NOT NULL,
PRIMARY KEY (`id`),
KEY `idx_b_c` (`b`,`c`),
KEY `idx_b_id` (`b`,`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
SQL1:select SQL_NO_CACHE * from test force index(idx_b_c) where b=1 order by c desc limit 2000,10
------------->
SQL2:select SQL_NO_CACHE * from test, (select SQL_NO_CACHE id from test force index(idx_b_c_id) where b=1 order by c desc limit 2000,10) temp where test.id=temp.id |
|