当前位置:网站首页>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"
返回结果
边栏推荐
- 1672. Total assets of the richest customers
- SSRS筛选器的IN运算(即包含于)用法
- Have you guys ever used CDC direct Mysql to Clickhouse
- 性能优化之关键渲染路径
- Crawler (6) - Web page data parsing (2) | the use of beautifulsoup4 in Crawlers
- Oracle with as ORA-00903: invalid table name 多表报错
- Other InterSystems%net tools
- Is the securities account opened by qiniu safe?
- sqlserver的CDC第一次查询的能读取到数据,但后面增删改读取不到,是什么原因
- Hough Transform 霍夫变换原理
猜你喜欢

Pointnet/Pointnet++点云数据集处理并训练

使用canal配合rocketmq监听mysql的binlog日志
![[发布] 一个测试 WebService 和数据库连接的工具 - DBTest v1.0](/img/4e/4154fec22035725d6c7aecd3371b05.jpg)
[发布] 一个测试 WebService 和数据库连接的工具 - DBTest v1.0

联想首次详解绿色智城数字孪生平台 破解城市双碳升级难点

神经网络物联网平台搭建(物联网平台搭建实战教程)

更安全、更智能、更精致,长安Lumin完虐宏光MINI EV?

The 300th weekly match of leetcode (20220703)

每日一题(2022-07-02)——最低加油次数

读写关闭的channel是啥后果?

One question per day (2022-07-02) - Minimum refueling times
随机推荐
Is the securities account opened by qiniu safe?
DeFi生态NFT流动性挖矿系统开发搭建
The 15th youth informatics competition in Shushan District in 2019
C # implementation defines a set of SQL statements that can be executed across databases in the middle of SQL (detailed explanation of the case)
From automation to digital twins, what can Tupo do?
Using SSH
英特尔集成光电研究最新进展推动共封装光学和光互连技术进步
请教一下 flinksql中 除了数据统计结果是状态被保存 数据本身也是状态吗
26. 删除有序数组中的重复项 C#解答
Unity adds a function case similar to editor extension to its script, the use of ContextMenu
How test engineers "attack the city" (Part 2)
Stream流
There are multiple divs in the large div, which are displayed on the same line. After overflow, scroll bars are generated without line breaks
Pointnet/Pointnet++点云数据集处理并训练
建立自己的网站(15)
问下各位大佬有用过cdc直接mysql to clickhouse的么
[uniapp] uniapp development app online Preview PDF file
正则替换【JS,正则表达式】
Guys, for help, I use MySQL CDC 2.2.1 (Flink 1.14.5) to write Kafka and set
26. Delete the duplicate item C solution in the ordered array