mysql using where_在MySQL中的explain中的using where和using index-mysql教程-

本篇文章的主要内容是关于在mysql数据库explain中的using where和using index的使用,感兴趣的朋友可以了解一下。

1. 查看表中的所有索引 show index from modify_passwd_log; 有两个 一个是id的主键索引 , 一个是email_id的普通索引

8556ef6c449516d9b64a016d7ccc624a.png

2. using index表示 使用到了索引 , 并且所取的数据完全在索引中就能拿到

explain select email_id from modify_passwd_log where email_id=670602;

8706c14a7019d17956984be3ff08fe9d.png

3. type是ref,where是空白:使用到了索引,但是查询的数据有没在索引中的,回表去拿数据了

explain select * from modify_passwd_log where email_id=670602;

6cf2f879ed53226674b57426d0075095.png

4. type是ref , where是 using where ,表示使用到了索引 , 但是也进行了where过滤

b60437dcb3ad8533637add433c1ea872.png

推荐课程:mysql视频教程

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值