暂无图片
mysql 中走了索引,怎么还提示using where ???
我来答
分享
暂无图片 匿名用户
mysql 中走了索引,怎么还提示using where ???

mysql> explain select * from test_order where a > 100 group by a;
+----+-------------+------------+------------+-------+---------------+-----------+---------+------+------+----------+-------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+------------+------------+-------+---------------+-----------+---------+------+------+----------+-------------+
| 1 | SIMPLE | test_order | NULL | index | idx_a_b_c | idx_a_b_c | 266 | NULL | 9927 | 49.99 | Using where |
+----+-------------+------------+------------+-------+---------------+-----------+---------+------+------+----------+-------------+

走了索引,怎么还提示using where  ??

create table `test_order` (
`id` int not null auto_increment comment 'id',
`a` int unsigned not null default '0',
`b` int unsigned not null default '0',
`c` varchar(64) not null default '',
`d` int default null,
primary key (`id`),
key `idx_a_b_c` (`a`,`b`,`c`),
key `idx_d` (`d`)
)

表中有10000条数据,

我来答
添加附件
收藏
分享
问题补充
2条回答
默认
最新
BAZINGA...

这儿的type 是index,说明是全扫描的索引,所以是using where; 建议你了解一下type值的含义

暂无图片 评论
暂无图片 有用 1
小年青。

type是index说明使用了索引扫描,using where表示使用了where条件进行过滤。你这个执行计划没啥问题

暂无图片 评论
暂无图片 有用 1
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
暂无图片墨值悬赏