EXPLAIN
SELECT * FROM test_askcomment WHERE cid IN(1,2,3) ORDER BY dateline DESC;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE test_askcomment ALL PRIMARY NULL NULL NULL 3 Using where; Using filesort
答案 0 :(得分:1)
ALTER TABLE `test_askcomment ` ADD INDEX `index1` (`cid`);
ALTER TABLE `test_askcomment ` ADD INDEX `index2` (`dateline `);
尝试索引您正在使用where子句的列或选择列