当前位置:网站首页>mysql中explain语句查询sql是否走索引,extra中的几种类型整理汇总
mysql中explain语句查询sql是否走索引,extra中的几种类型整理汇总
2022-06-29 20:05:00 【游戏编程】
1.using index通过二级普通索引查找,实现了覆盖索引,不用进行回表查询
2.using index condition通过二级普通索引查找,在通过索引查到的结果后还有where条件过滤,而且这个过滤筛选是只需要用二级普通索引就可以实现,不用在内存中进行判断筛选。但是需要回表查询需要的字段值。
3.using where不管有没有通过索引查找,只要加载了数据到内存进行where条件筛选,都是
4.using index & using where:查找使用了索引,但是需要的数据都在索引列中能找到,所以不需要回表查询数据
实际例子
假如有一个表xxx,给modify_date上索引
1.using index通过二级普通索引查找,实现了覆盖索引,不用进行回表查询
explainSELECT modify_date from xxx

2.using index condition通过二级普通索引查找,需要回表
explainSELECT * from xxx where modify_date > "2022-06-27 10:27:07" and modify_date < "2022-06-28 0:0:0"

3.using where不走索引查找
explainSELECT * from xxx where create_date > "2022-06-27 10:27:07" and create_date < "2022-06-28 0:0:0"

4.using index & using where:查找使用了索引,但是需要的数据都在索引列中能找到,所以不需要回表查询数据
explainSELECT modify_date from xxx where modify_date > "2022-06-27 10:27:07" and modify_date < "2022-06-28 0:0:0"
返回结果

作者:Koikoi123
游戏编程,一个游戏开发收藏夹~
如果图片长时间未显示,请使用Chrome内核浏览器。
边栏推荐
- 第二章(物理层)
- 关于印发宝安区重点产业项目和总部项目遴选及用地保障实施细则(2022修订版)的通知
- Dynamics crm: among locally deployed servers, sandbox, unzip, VSS, asynchronous and monitor services
- Talk about the delta configuration of Eureka
- 软件工程—原理、方法与应用
- Is it safe to open a new bond Online
- Flume-ng配置
- 【编译原理】类型检查
- Jmeter之BeanShell详解和夸线程调用
- Chapter II (physical layer)
猜你喜欢
JMeter BeanShell explanation and thread calling
Luoqingqi: has high-end household appliances become a red sea? Casati took the lead in breaking the game
软件测试逻辑覆盖相关理解
Performance improvement at the cost of other components is not good
Linux Installation mysql8
data link layer
苹果iPhone手机升级系统内存空间变小不够如何解决?
Etcd database source code analysis - put process of server
liunx指令
一次 Keepalived 高可用的事故,让我重学了一遍它!
随机推荐
There is no small green triangle on the method in idea
【译】十二因子应用(四)
ETCD数据库源码分析——服务端PUT流程
Sword finger offer 41 Median in data stream
Flutter calls Baidu map app to realize location search and route planning
[compilation principle] syntax analysis
Sword finger offer 59 - ii Maximum value of the queue
Startservice() procedure
【编译原理】语义分析
ASP.Net Core创建Razor页面上传多个文件(缓冲方式)(续)
Nutch2.1在Windows平台上使用Eclipse debug 存储在MySQL的搭建过程
剑指 Offer 66. 构建乘积数组
XSS漏洞
【剑指Offer】51. 数组中的逆序对
Oracle保留字查询
童年经典蓝精灵之百变蓝爸爸数字藏品中奖名单公布
Nutch2.1 using eclipse debug to store the build process in MySQL on the windows platform
Go: how to write a correct UDP server
Flume configuration 3 - interceptor filtering
A keepalived high availability accident made me learn it again!