为什么这个sql不使用密钥?

时间:2015-03-26 16:40:54

标签: mysql sql-order-by limit

mysql> explain select * from dg_users order by uid desc limit 83,10;
+----+-------------+----------+------+---------------+------+---------+------+------+----------------+
| id | select_type | table    | type | possible_keys | key  | key_len | ref  | rows | Extra          |
+----+-------------+----------+------+---------------+------+---------+------+------+----------------+
|  1 | SIMPLE      | dg_users | ALL  | NULL          | NULL | NULL    | NULL | 2319 | Using filesort |
+----+-------------+----------+------+---------------+------+---------+------+------+----------------+
1 row in set (0.00 sec)

mysql> explain select * from dg_users order by uid desc limit 82,10;
+----+-------------+----------+-------+---------------+---------+---------+------+------+-------+
| id | select_type | table    | type  | possible_keys | key     | key_len | ref  | rows | Extra |
+----+-------------+----------+-------+---------------+---------+---------+------+------+-------+
|  1 | SIMPLE      | dg_users | index | NULL          | PRIMARY | 4       | NULL |   92 | NULL  |
+----+-------------+----------+-------+---------------+---------+---------+------+------+-------+
1 row in set (0.00 sec)

这就像结果。 当我改变"限制82,10"为了限制83,10",钥匙将丢失。

我只是想知道为什么?认为

0 个答案:

没有答案