当前位置:网站首页>mysql中explain语句查询sql是否走索引,extra中的几种类型整理汇总
mysql中explain语句查询sql是否走索引,extra中的几种类型整理汇总
2022-07-04 18:00:00 【Koikoi123】
1.using index通过二级普通索引查找,实现了覆盖索引,不用进行回表查询
2.using index condition通过二级普通索引查找,在通过索引查到的结果后还有where条件过滤,而且这个过滤筛选是只需要用二级普通索引就可以实现,不用在内存中进行判断筛选。但是需要回表查询需要的字段值。
3.using where不管有没有通过索引查找,只要加载了数据到内存进行where条件筛选,都是
4.using index & using where:查找使用了索引,但是需要的数据都在索引列中能找到,所以不需要回表查询数据
实际例子
假如有一个表xxx,给modify_date上索引
1.using index通过二级普通索引查找,实现了覆盖索引,不用进行回表查询
explain
SELECT modify_date
from xxx
2.using index condition通过二级普通索引查找,需要回表
explain
SELECT *
from xxx where modify_date > "2022-06-27 10:27:07" and modify_date < "2022-06-28 0:0:0"
3.using where不走索引查找
explain
SELECT *
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:查找使用了索引,但是需要的数据都在索引列中能找到,所以不需要回表查询数据
explain
SELECT modify_date
from xxx where modify_date > "2022-06-27 10:27:07" and modify_date < "2022-06-28 0:0:0"
返回结果
边栏推荐
- Wireshark网络抓包
- To sort out messy header files, I use include what you use
- 偏移量函数及开窗函数
- The page element is vertically and horizontally centered, realizing the vertical and horizontal centering of known or unknown width.
- SSRS筛选器的IN运算(即包含于)用法
- .NET ORM框架HiSql实战-第二章-使用Hisql实现菜单管理(增删改查)
- 在线SQL转Excel(xls/xlsx)工具
- Technology sharing | interface testing value and system
- 自由小兵儿
- 基于NCF的多模块协同实例
猜你喜欢
正则替换【JS,正则表达式】
Hough transform Hough transform principle
Oracle with as ORA-00903: invalid table name 多表报错
[uniapp] uniapp development app online Preview PDF file
2022CoCa: Contrastive Captioners are Image-Text Fountion Models
Use canal and rocketmq to listen to MySQL binlog logs
与二值化阈值处理相关的OpenCV函数、方法汇总,便于对比和拿来使用
[发布] 一个测试 WebService 和数据库连接的工具 - DBTest v1.0
redis分布式锁的8大坑总结梳理
在线文本行固定长度填充工具
随机推荐
An example of multi module collaboration based on NCF
Pytorch学习(四)
小发猫物联网平台搭建与应用模型
2021 Hefei informatics competition primary school group
2022CoCa: Contrastive Captioners are Image-Text Fountion Models
Shell programming core technology II
大佬们,求助一下,我用mysql cdc 2.2.1(flink 1.14.5)写入kafka,设置
LM10丨余弦波动顺势网格策略
添加命名空间声明
Go microservice (II) - detailed introduction to protobuf
Oracle with as ora-00903: invalid table name multi report error
Explore the contour drawing function drawcontours() of OpenCV in detail with practical examples
Technology sharing | interface testing value and system
Nebula Importer 数据导入实践
利用策略模式优化if代码【策略模式】
安徽 中安在线文旅频道推出“跟着小编游安徽”系列融媒体产品
升级智能开关,“零火版”、“单火”接线方式差异有多大?
国元期货是正规平台吗?在国元期货开户安全吗?
如何使用Async-Awati异步任務處理代替BackgroundWorker?
[mathematical basis of machine learning] (I) linear algebra (Part 1 +)