- 论坛徽章:
- 0
|
哎
没有索引是要扫描全表的;
虽然看不到 Using filesort 了,
但是更慢!
看看 rows 那可是 3百多万条 啊,而有索引才 1 万多条。
mysql> explain SELECT * FROM `notice_message` WHERE submit_date > '2009-03-05 00:00:00' AND submit_date < '2009-03-06 00:00:00' ORDER BY id DESC LIMIT 0,5000;
+----+-------------+----------------+-------+---------------+---------+---------+------+---------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+----------------+-------+---------------+---------+---------+------+---------+-------------+
| 1 | SIMPLE | notice_message | index | NULL | PRIMARY | 4 | NULL | 3805346 | Using where |
+----+-------------+----------------+-------+---------------+---------+---------+------+---------+-------------+
1 row in set (0.00 sec)
[ 本帖最后由 simeiren 于 2009-4-3 18:25 编辑 ] |
|