暂无图片
select * ,怎么还提示Using index condition ,索引全覆盖?
我来答
分享
暂无图片 匿名用户
select * ,怎么还提示Using index condition ,索引全覆盖?

mysql> explain select * from test_order where a = 100 and b > 200 group by b;
+----+-------------+------------+------------+-------+---------------+-----------+---------+------+------+----------+-----------------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+------------+------------+-------+---------------+-----------+---------+------+------+----------+-----------------------+
| 1 | SIMPLE | test_order | NULL | range | idx_a_b_c | idx_a_b_c | 8 | NULL | 1 | 100.00 | Using index condition |
+----+-------------+------------+------------+-------+---------------+-----------+---------+------+------+----------+-----------------------+
1 row in set, 1 warning (0.00 sec)



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 条数据

select * ,不是select 索引字段, 怎么还提示索引全覆盖??

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

Using index condition 是索引下推
Using index 才是覆盖索引

暂无图片 评论
暂无图片 有用 3
张sir

楼上说的对,using index condition是索引下推,说明首先a=100用到了索引,b>200在innodb层进行了筛选,没有到server层筛选。

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