mysql> explain SELECT * FROM uchome_feed force index(uid) WHERE uid IN ('0',16,109,164,182,238,268,388,403,475);
+----+-------------+-------------+------+---------------+------+---------+------+--------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------------+------+---------------+------+---------+------+--------+-------------+
| 1 | SIMPLE | uchome_feed | ALL | uid | NULL | NULL | NULL | 449779 | Using where |
+----+-------------+-------------+------+---------------+------+---------+------+--------+-------------+强制使用索引居然也没用,mysql in操作难道不走索引??
该如何优化??
+----+-------------+-------------+------+---------------+------+---------+------+--------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------------+------+---------------+------+---------+------+--------+-------------+
| 1 | SIMPLE | uchome_feed | ALL | uid | NULL | NULL | NULL | 449779 | Using where |
+----+-------------+-------------+------+---------------+------+---------+------+--------+-------------+强制使用索引居然也没用,mysql in操作难道不走索引??
该如何优化??
解决方案 »
- 利用游标更新表,效率问题,急!!!!
- 数据长度是什么?
- postgresql 中文按拼音排序
- sql的STUFF函数和mysql的哪个函数一样,如果没有,可以写个不?
- 出现 table '#sql- xx' is full !!!
- -uroot -p命令怎么进不了数据库,提示语句错误,-h127.0.0.1 -uroot -paaaaaa;也一样,怎么回事呢?
- 小弟SQL初学者一道题憋了2个晚上没有憋出来,希望达人帮忙看看!明天就要了交了!
- 谁有MySQL++ 1.7.9 For VC++6.0 的版本
- 求助,启动mysql服务总提示路径错误
- PHPMYADMIN奇怪问题
- linux下连接windows下的mysql,速度比较慢
- 不能插入“㎡”这个字符
show index from uchome_feed;看一下。
+-------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+-------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| uchome_feed | 0 | PRIMARY | 1 | feedid | A | 449779 | NULL | NULL | | BTREE | |
| uchome_feed | 1 | uid | 1 | uid | A | 449779 | NULL | NULL | | BTREE | |
| uchome_feed | 1 | uid | 2 | dateline | A | 449779 | NULL | NULL | | BTREE | |
| uchome_feed | 1 | dateline | 1 | dateline | A | 24987 | NULL | NULL | | BTREE | |
| uchome_feed | 1 | hot | 1 | hot | A | 37 | NULL | NULL | | BTREE | |
| uchome_feed | 1 | id | 1 | id | A | 1578 | NULL | NULL | | BTREE | |
| uchome_feed | 1 | id | 2 | idtype | A | 3627 | NULL | NULL | | BTREE | |
| uchome_feed | 1 | icon | 1 | icon | A | 73 | 20 | NULL | | BTREE | |
| uchome_feed | 1 | uids | 1 | uid | A | 449779 | NULL | NULL | | BTREE | |
+-------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
9 rows in set (0.01 sec)