可以优化此查询以不使用filesort
CREATE TABLE `table` (
`name` varchar(100) collate utf8_unicode_ci NOT NULL,
`area` int(10) unsigned NOT NULL,
`count` int(10) unsigned NOT NULL,
KEY `index` (`name`,`count`,`area`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
SELECT name, count, area
FROM table
WHERE name LIKE 'input%' ORDER BY count DESC, area ASC
+----+-------------+-----------+-------+---------------+------+---------+------+------+------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-----------+-------+---------------+------+---------+------+------+------------------------------------------+
| 1 | SIMPLE | table | range | index | index| 302 | NULL | 6076 | Using where; Using index; Using filesort |
+----+-------------+-----------+-------+---------------+------+---------+------+------+------------------------------------------+
编辑:另外,我已经测试了两个ORDER BY都是ASC并且结果是相同的。