using index mysql_在MySQL中的explain中的using where和using index

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

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

202d9869ffd3a4c7c320e99d6cc2d6c9.png

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

explain select email_id from modify_passwd_log where email_id=670602;

795e455360765d93e898b10b6eb3aeff.png

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

explain select * from modify_passwd_log where email_id=670602;

6a119e9104213601d615ac74ffb6ef42.png

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

82679b6bac58312853c501b569075283.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值