CREATETABLE `user_profile` (`id`int(11) NOT NULL,`city`varchar(16) NOT NULL,`name`varchar(16) NOT NULL,`age`int(11) NOT NULL,`addr`varchar(128) DEFAULTNULL,PRIMARY KEY (`id`),KEY`city` (`city`)) ENGINE=InnoDB;-- 查询某个城市按姓名排名的前1000个人的城市、姓名和年龄select city, name, age from user_profile where city ='上海'order bynamelimit1000;explain select city, name, age from user_profile where city ='上海'order bynamelimit1000;+----+-------------+--------------+------------+------+---------------+------+---------+-------+------+----------+---------------------------------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+--------------+------------+------+---------------+------+---------+-------+------+----------+---------------------------------------+
| 1 | SIMPLE | user_profile | NULL | ref | city | city | 66 | const | 1 | 100.00 | Using index condition; Using filesort |
+----+-------------+--------------+------------+------+---------------+------+---------+-------+------+----------+---------------------------------------+
简单条件的 order by
select city, name, age from user_profile where city = '上海' order by name limit 1000 是如何工作的?