MySQL Explain解析(非常详细)


系统性能的优劣取决于我们sql的查询速度,MySQL Explain命令是分析SQL性能及优化不可缺少的一部分。

Explain被我们称为解释器,通过 explain 我们可以知道以下信息:表的读取顺序,数据读取操作的类型,可能会使用哪些索引,实际真正使用了哪些索引,表之间的引用,每张表有多少行被优化器查询等信息。

Explain基本语法

explain [extended|partition]select
在select前加explain关键字,MySQL会返回该查询的执行计划而不是执行这条SQL

mysql> explain select * from student where id=1;
+----+-------------+---------+-------+---------------+---------+---------+-------+------+-------+
| id | select_type | table   | type  | possible_keys | key     | key_len | ref   | rows | Extra |
+----+-------------+---------+-------+---------------+---------+---------+-------+------+-------+
|  1 | SIMPLE      | student | const | PRIMARY       | PRIMARY | 4       | const |    1 | NULL  |
+----+-------------+---------+-------+---------------+---------+---------+-------+------+-------+
1 row in set

根据语法我们知道explain还有两种其他的用法:

  1. explain extended :能够在原本explain的基础上额外的提供一些查询优化的信息,这些信息可以通过mysql的show warnings命令得到,从而看出优化器优化了什么。
mysql> explain extended select * from student where id =1;
+----+-------------+---------+-------+---------------+---------+---------+-------+------+----------+-------+
| id | select_type | table   | type  | possible_keys | key     | key_len | ref   | rows | filtered | Extra |
+----+-------------+---------+-------+---------------+---------+---------+-------+------+----------+-------+
|  1 | SIMPLE      | student | const | PRIMARY       | PRIMARY | 4       | const |    1 |      100 | NULL  |
+----+-------------+---------+-------+---------------+---------+---------+-------+------+----------+-------+
1 row in set

mysql> show warnings;
+-------+------+--------------------------------------------------------------------------------------------------------------------------+
| Level | Code | Message                                                                                                                  |
+-------+------+--------------------------------------------------------------------------------------------------------------------------+
| Note  | 1003 | /* select#1 */ select '1' AS `id`,'stu_1' AS `name`,'2019-12-17 14:29:17' AS `create_time` from `demo`.`student` where 1 |
+-------+------+--------------------------------------------------------------------------------------------------------------------------+
1 row in set
  1. explain partitions:相比 explain 多了个 partitions 字段,如果查询是基于分区表的话,会显示查询将访问的分区。

Explain列的含义

字段说明
idid列的编号是 select 的序列号,有几个 select 就有几个id,id不同,id值越大,优先级越高,越先执行
select_type显示本行是简单或复杂select。如果查询有任何复杂的子查询,则最外层标记为PRIMARY(DERIVED、UNION、UNION RESUlT)
table访问查询的表名或表别名
type表的访问类型( MySQL 如何查询表中的行记录)效率高低:const / eq_ref / ref / range / index / all
possible_keys指出MySQL能使用哪个索引在该表中找到行
keyMySQL实际决定使用的键(索引)。如果没有选择索引,键是NULL
key_len实际使用的索引长度(单位:字节)该字段显示为索引字段的最大可能长度,并非实际使用长度。
ref用于索引查找的值的来源,如果值未常量,则 ref 为 const
rows预计查询需要扫描的行数(在表或索引树中)
filtered查询条件所过滤的行记录数占比
Extra额外的信息:
1. Using filesort:说明mysql会对数据适用一个外部的索引排序。而不是按照表内的索引顺序进行读取。MySQL中无法利用索引完成排序操作称为“文件排序”
2. Using temporary:使用了临时表保存中间结果,mysql在查询结果排序时使用临时表。常见于排序order by和分组查询group by。
3、Using index:表示相应的select操作用使用覆盖索引,避免访问了表的数据行。如果同时出现using where,表名索引被用来执行索引键值的查找;如果没有同时出现using where,表名索引用来读取数据而非执行查询动作。
4、Using where :表明使用where过滤
5、using join buffer:使用了连接缓存
6、impossible where:where子句的值总是false,不能用来获取任何元组
7、select tables optimized away:在没有group by子句的情况下,基于索引优化Min、max操作或者对于MyISAM存储引擎优化count(*),不必等到执行阶段再进行计算,查询执行计划生成的阶段即完成优化。
8、distinct:优化distinct操作,在找到第一匹配的元组后即停止找同样值的动作

详细介绍列的含义

1. id列

id 的值为数值,其表示的是SQL执行中的执行顺序,规则如下:

  • 如果 id 值相同,则执行顺序为:从上到下
  • 如果 id 值不同,则执行顺序为: id 值越大的越先执行
  • 如果 id 值相同,则可以认为他们是同一分组,同一分组中执行顺序为:从上到下
  • 在所有组中, id 值越大的越先执行
  • 如果 id 值为 null ,则表示这是一个临时表,临时表不在SQL总出现,因此它的id是NULL
    MySQL将 select 查询分为简单查询和复杂查询。复杂查询分为三类:简单子查询、派生表(from语句中的子查询)、union 查询。
  1. 简单子查询
mysql> explain select (select id from student limit 1) from student;
+----+-------------+---------+-------+---------------+----------+---------+------+------+-------------+
| id | select_type | table   | type  | possible_keys | key      | key_len | ref  | rows | Extra       |
+----+-------------+---------+-------+---------------+----------+---------+------+------+-------------+
|  1 | PRIMARY     | student | index | NULL          | idx_name | 99      | NULL |    4 | Using index |
|  2 | SUBQUERY    | student | index | NULL          | idx_name | 99      | NULL |    4 | Using index |
+----+-------------+---------+-------+---------------+----------+---------+------+------+-------------+
2 rows in set
  1. from 语句中的子查询
mysql> explain select * from (select id from student limit 1) tem
;
+----+-------------+------------+--------+---------------+----------+---------+------+------+-------------+
| id | select_type | table      | type   | possible_keys | key      | key_len | ref  | rows | Extra       |
+----+-------------+------------+--------+---------------+----------+---------+------+------+-------------+
|  1 | PRIMARY     | <derived2> | system | NULL          | NULL     | NULL    | NULL |    1 | NULL        |
|  2 | DERIVED     | student    | index  | NULL          | idx_name | 99      | NULL |    4 | Using index |
+----+-------------+------------+--------+---------------+----------+---------+------+------+-------------+
2 rows in set
  1. union查询
mysql> explain select id from student union all select id from course;
+------+--------------+------------+-------+---------------+----------+---------+------+------+-----------------+
| id   | select_type  | table      | type  | possible_keys | key      | key_len | ref  | rows | Extra           |
+------+--------------+------------+-------+---------------+----------+---------+------+------+-----------------+
|    1 | PRIMARY      | student    | index | NULL          | idx_name | 99      | NULL |    4 | Using index     |
|    2 | UNION        | course     | index | NULL          | idx_name | 99      | NULL |    4 | Using index     |
| NULL | UNION RESULT | <union1,2> | ALL   | NULL          | NULL     | NULL    | NULL | NULL | Using temporary |
+------+--------------+------------+-------+---------------+----------+---------+------+------+-----------------+
3 rows in set

2. select_type列

这一列表示的是对应行对应的查询类型,到底是简单查询还是复杂查询,如果是复杂的查询,又是简单子查询、from语句中的子查询、union 查询复杂查询中的哪一种。

  1. simple :简单的select查询,查询中不包含子查询或者 union
mysql> explain select id from student where id =1;
+----+-------------+---------+-------+---------------+---------+---------+-------+------+-------------+
| id | select_type | table   | type  | possible_keys | key     | key_len | ref   | rows | Extra       |
+----+-------------+---------+-------+---------------+---------+---------+-------+------+-------------+
|  1 | SIMPLE      | student | const | PRIMARY       | PRIMARY | 4       | const |    1 | Using index |
+----+-------------+---------+-------+---------------+---------+---------+-------+------+-------------+
1 row in set
  1. primary :复杂查询最外层的查询类型
  2. subquery :在 select 或 where 列表中包含了子查询
  3. derived:包含在 from 子句中的子查询。MySQL会将结果存放在一个临时表中,也称为派生表

举例说明这三种类型:

mysql> explain select (select id from student limit 1) from (select id from student where id>1)temp;
+----+-------------+------------+-------+---------------+----------+---------+------+------+--------------------------+
| id | select_type | table      | type  | possible_keys | key      | key_len | ref  | rows | Extra                    |
+----+-------------+------------+-------+---------------+----------+---------+------+------+--------------------------+
|  1 | PRIMARY     | <derived3> | ALL   | NULL          | NULL     | NULL    | NULL |    3 | NULL                     |
|  3 | DERIVED     | student    | range | PRIMARY       | PRIMARY  | 4       | NULL |    3 | Using where; Using index |
|  2 | SUBQUERY    | student    | index | NULL          | idx_name | 99      | NULL |    4 | Using index              |
+----+-------------+------------+-------+---------------+----------+---------+------+------+--------------------------+
3 rows in set
  1. union:union查询语句出现在union之后的第二个和以后的查询会被标为union类型
  2. union result :从 union 构建的临时表检索结果的查询类型

举例说明 union 和union result 类型:

mysql> explain select id from student union all select id from course;
+------+--------------+------------+-------+---------------+----------+---------+------+------+-----------------+
| id   | select_type  | table      | type  | possible_keys | key      | key_len | ref  | rows | Extra           |
+------+--------------+------------+-------+---------------+----------+---------+------+------+-----------------+
|    1 | PRIMARY      | student    | index | NULL          | idx_name | 99      | NULL |    4 | Using index     |
|    2 | UNION        | course     | index | NULL          | idx_name | 99      | NULL |    4 | Using index     |
| NULL | UNION RESULT | <union1,2> | ALL   | NULL          | NULL     | NULL    | NULL | NULL | Using temporary |
+------+--------------+------------+-------+---------------+----------+---------+------+------+-----------------+
3 rows in set

3. table列

这一列看名称就知道是指的具体查询的table名称。

当 from 子句中有子查询时,table列是 格式,表示当前查询依赖 id=N 的查询,于是先执行 id=N 的查询。当有 union 时,UNION RESULT 的 table 列的值为 <union1,2>,1和2表示参与 union 的 select 行id。

4. type列

这一列表示关联类型或访问类型,即MySQL决定如何查找表中的行

最优到最差分别为:system > const > eq_ref > ref > fulltext > ref_or_null > index_merge > unique_subquery > index_subquery > range > index > ALL

  1. const, system:Mysql查询对其进行优化并转化为一个常量,只查询一次就搜索出结果,用于 primary key 或 unique key 的所有列与常数比较时,所以表最多有一个匹配行,读取1次,速度比较快。
mysql> explain select id from (select id from student where id =1) as temp
;
+----+-------------+------------+--------+---------------+---------+---------+-------+------+-------------+
| id | select_type | table      | type   | possible_keys | key     | key_len | ref   | rows | Extra       |
+----+-------------+------------+--------+---------------+---------+---------+-------+------+-------------+
|  1 | PRIMARY     | <derived2> | system | NULL          | NULL    | NULL    | NULL  |    1 | NULL        |
|  2 | DERIVED     | student    | const  | PRIMARY       | PRIMARY | 4       | const |    1 | Using index |
+----+-------------+------------+--------+---------------+---------+---------+-------+------+-------------+
2 rows in set
  1. eq_ref:唯一性索引扫描,对于每个索引键,表中只有一条记录与之匹配。常见于主键或唯一索引扫描
mysql> explain select stu.id from student stu inner join course c on stu.id = c.id;
+----+-------------+-------+--------+---------------+----------+---------+-------------+------+-------------+
| id | select_type | table | type   | possible_keys | key      | key_len | ref         | rows | Extra       |
+----+-------------+-------+--------+---------------+----------+---------+-------------+------+-------------+
|  1 | SIMPLE      | stu   | index  | PRIMARY       | idx_name | 99      | NULL        |    4 | Using index |
|  1 | SIMPLE      | c     | eq_ref | PRIMARY       | PRIMARY  | 4       | demo.stu.id |    1 | Using index |
+----+-------------+-------+--------+---------------+----------+---------+-------------+------+-------------+
2 rows in set
  1. ref:相比 eq_ref,不使用唯一索引,而是使用普通索引或者联合索引的部分前缀,索引要和某个值相比较,可能会找到多个符合条件的行.

mysql> explain select * from student where name='stu_1';
+----+-------------+---------+------+---------------+----------+---------+-------+------+-----------------------+
| id | select_type | table   | type | possible_keys | key      | key_len | ref   | rows | Extra                 |
+----+-------------+---------+------+---------------+----------+---------+-------+------+-----------------------+
|  1 | SIMPLE      | student | ref  | idx_name      | idx_name | 99      | const |    1 | Using index condition |
+----+-------------+---------+------+---------------+----------+---------+-------+------+-----------------------+
1 row in set
#使用联合索引的左前部分查询 依然是ref类型
mysql> explain select * from student a inner join student_course b on a.id=b.student_id;
+----+-------------+-------+------+--------------------+--------------------+---------+-----------+------+--------------------------+
| id | select_type | table | type | possible_keys      | key                | key_len | ref       | rows | Extra                    |
+----+-------------+-------+------+--------------------+--------------------+---------+-----------+------+--------------------------+
|  1 | SIMPLE      | a     | ALL  | PRIMARY            | NULL               | NULL    | NULL      |    4 | NULL                     |
|  1 | SIMPLE      | b     | ref  | idx_student_course | idx_student_course | 5       | demo.a.id |    2 | Using where; Using index |
+----+-------------+-------+------+--------------------+--------------------+---------+-----------+------+--------------------------+
2 rows in set
  1. ref_or_null:与ref类型差不多,但是这种类型可以搜索为Null的行
mysql> explain select id
 from student where name is null or name='stu_1';
+----+-------------+---------+-------------+---------------+----------+---------+-------+------+--------------------------+
| id | select_type | table   | type        | possible_keys | key      | key_len | ref   | rows | Extra                    |
+----+-------------+---------+-------------+---------------+----------+---------+-------+------+--------------------------+
|  1 | SIMPLE      | student | ref_or_null | idx_name      | idx_name | 99      | const |    2 | Using where; Using index |
+----+-------------+---------+-------------+---------------+----------+---------+-------+------+--------------------------+
1 row in set
  1. index_merge:使用了索引合并的优化方法
#郁闷 测试建的表不行 换了一张表就可以了搞不懂!!!
mysql> explain select * from project where projectId=100 or contractId='222';
+----+-------------+-------------+-------------+-------------------------+-------------------------+---------+------+------+---------------------------------------------------+
| id | select_type | table       | type        | possible_keys           | key                     | key_len | ref  | rows | Extra                                             |
+----+-------------+-------------+-------------+-------------------------+-------------------------+---------+------+------+---------------------------------------------------+
|  1 | SIMPLE      | project | index_merge | PRIMARY,idx_contract_id | PRIMARY,idx_contract_id | 8,303   | NULL |    2 | Using union(PRIMARY,idx_contract_id); Using where |
+----+-------------+-------------+-------------+-------------------------+-------------------------+---------+------+------+---------------------------------------------------+
1 row in set

6.range: 范围扫描通常出现在 in(), between ,> ,<, >= 等操作中。使用一个索引来检索给定范围的行

mysql> explain select *
 from student where id <>3;
+----+-------------+---------+-------+---------------+---------+---------+------+------+-------------+
| id | select_type | table   | type  | possible_keys | key     | key_len | ref  | rows | Extra       |
+----+-------------+---------+-------+---------------+---------+---------+------+------+-------------+
|  1 | SIMPLE      | student | range | PRIMARY       | PRIMARY | 4       | NULL |    3 | Using where |
+----+-------------+---------+-------+---------------+---------+---------+------+------+-------------+
1 row in set
  1. index:Full Index Scan,Index与All区别为index类型只遍历索引树。这通常比ALL快,因为索引文件通常比数据文件小
mysql> explain select id from student
;
+----+-------------+---------+-------+---------------+----------+---------+------+------+-------------+
| id | select_type | table   | type  | possible_keys | key      | key_len | ref  | rows | Extra       |
+----+-------------+---------+-------+---------------+----------+---------+------+------+-------------+
|  1 | SIMPLE      | student | index | NULL          | idx_name | 99      | NULL |    4 | Using index |
+----+-------------+---------+-------+---------------+----------+---------+------+------+-------------+
1 row in set
  1. All:扫描全表,与index其实都是扫描全表进行检索数据,区别在于,index类型是扫描索引树进行数据扫描,而All类型则是直接扫磁盘,所以相对index类型比较慢
mysql> explain select * from student
;
+----+-------------+---------+------+---------------+------+---------+------+------+-------+
| id | select_type | table   | type | possible_keys | key  | key_len | ref  | rows | Extra |
+----+-------------+---------+------+---------------+------+---------+------+------+-------+
|  1 | SIMPLE      | student | ALL  | NULL          | NULL | NULL    | NULL |    4 | NULL  |
+----+-------------+---------+------+---------------+------+---------+------+------+-------+
1 row in set

5. possible_keys列

显示此次查询可能会用到的索引,一个或者是多个,查询涉及到的字段上若存在索引,则该索引将被列出,但不一定会应用。
explain 时可能出现 possible_keys 有列,而 key 显示 NULL 的情况,这种情况是因为表中数据不多,mysql认为索引对此查询帮助不大,选择了全表查询。
如果该列是NULL,则没有相关的索引。在这种情况下,可以通过检查 where 子句看是否可以创造一个适当的索引来提高查询性能,然后用 explain 查看效果。但是有一种情况也可能会走索引,如果出现 覆盖索引 的情况即使该列为null 依然有可能会走索引查询

mysql> explain select student_id,course_id from student_course;
+----+-------------+----------------+-------+---------------+--------------------+---------+------+------+-------------+
| id | select_type | table          | type  | possible_keys | key                | key_len | ref  | rows | Extra       |
+----+-------------+----------------+-------+---------------+--------------------+---------+------+------+-------------+
|  1 | SIMPLE      | student_course | index | NULL          | idx_student_course | 10      | NULL |   16 | Using index |
+----+-------------+----------------+-------+---------------+--------------------+---------+------+------+-------------+
1 row in set

6. key列

mysql实际采用哪个索引来优化对该表的访问,如果想强制指定索引或者忽视索引,可在查询中使用 force index、ignore index

7. key_len列

表示索引中使用的字节数,可通过该列计算查询中使用的索引的长度,在不损失精确性的情况下,长度越短越好,key_len表示的是索引的最大长度,而不是实际使用长度。

mysql> explain select *
 from student_course where student_id=1;
+----+-------------+----------------+------+--------------------+--------------------+---------+-------+------+-------------+
| id | select_type | table          | type | possible_keys      | key                | key_len | ref   | rows | Extra       |
+----+-------------+----------------+------+--------------------+--------------------+---------+-------+------+-------------+
|  1 | SIMPLE      | student_course | ref  | idx_student_course | idx_student_course | 5       | const |    4 | Using index |
+----+-------------+----------------+------+--------------------+--------------------+---------+-------+------+-------------+
1 row in set

key_len计算规则如下:

  • 字符型
    • char(n):n字节长度
    • varchar(n):2字节存储字符串长度,如果是utf-8,则长度 3n + 2
  • 数值型
    • tinyint:1字节
    • smallint:2字节
    • int:4字节
    • bigint:8字节
  • 时间类型
    • date:3字节
    • timestamp:4字节
    • datetime:8字节
  • 如果字段允许为 NULL,需要额外增加1字节记录是否为 NULL

8. ref列

这一列显示了在key列记录的索引中,表查找值所用到的列或常量,常见的有:const(常量),func,NULL,字段名

9. rows列

这一列表示这条SQL可能要检索的数据行数,并不是返回结果集的行数。

10.Extra列

这一列展示的是一些额外的信息,但是也是十分重要的,对于我们提升SQL 的检索性能是很有帮助的。
常见的类型如下:

  • distinct: 一旦mysql找到了与行相联合匹配的行,就不再搜索了
mysql> explain select distinct 
name from student a inner join student_course b on a.id=b.student_id;
+----+-------------+-------+-------+--------------------+--------------------+---------+-----------+------+------------------------------------+
| id | select_type | table | type  | possible_keys      | key                | key_len | ref       | rows | Extra                              |
+----+-------------+-------+-------+--------------------+--------------------+---------+-----------+------+------------------------------------+
|  1 | SIMPLE      | a     | index | PRIMARY,idx_name   | idx_name           | 99      | NULL      |    4 | Using index; Using temporary       |
|  1 | SIMPLE      | b     | ref   | idx_student_course | idx_student_course | 5       | demo.a.id |    2 | Using where; Using index; Distinct |
+----+-------------+-------+-------+--------------------+--------------------+---------+-----------+------+------------------------------------+
2 rows in set
  • Using index:表示相应的select操作中使用了覆盖索引(Covering Index),避免访问了表的数据行,效率还是非常可观的。

覆盖索引:简单的理解就是这次select的字段只从索引中就可以获取的到,没有必要再去浪费一次IO读取行数据,换句话说就是查询的列被索引列所覆盖

  • Using where:就是使用了where条件查询。mysql服务器将在存储引擎检索行后再进行过滤。就是先读取整行数据,再按 where 条件进行检查,符合就留下,不符合就丢弃。
  • Using temporary:mysql需要创建一张临时表来处理查询结果。出现这种情况一般是要进行优化的,首先是想到用索引来优化。这种类型常见于order by 和group by的查询中
mysql> explain select distinct name from student 
order by create_time;
+----+-------------+---------+-------+---------------+----------+---------+------+------+---------------------------------+
| id | select_type | table   | type  | possible_keys | key      | key_len | ref  | rows | Extra                           |
+----+-------------+---------+-------+---------------+----------+---------+------+------+---------------------------------+
|  1 | SIMPLE      | student | index | idx_name      | idx_name | 99      | NULL |    4 | Using temporary; Using filesort |
+----+-------------+---------+-------+---------------+----------+---------+------+------+---------------------------------+
1 row in set
  • Using filesort:对查询结果进行外部索引排序而不是按索引次序从表里读取行,这种情况可以考虑建立索引来进行优化。

测试表及数据

#创建测试表
CREATE TABLE `student` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(32) DEFAULT NULL,
  `create_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_name` (`name`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `course` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(32) DEFAULT NULL,
  `create_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `student_course` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `student_id` int(11) DEFAULT NULL,
  `course_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_student_course` (`student_id`,`course_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

#插入测试数据
insert into student(name,create_time) VALUES('stu_1',now()),('stu_2',now()),('stu_3',now()),('stu_4',now());
insert into course(name,create_time) VALUES('cors_1',now()),('cors_2',now()),('cors_3',now()),('cors_4',now());
insert into student_course(student_id,course_id) VALUES(1,1),(1,2),(1,3),(1,4),(2,1),(2,2),(2,3),(2,4),(3,1),(3,2),(3,3),(3,4),(4,1),(4,2),(4,3),(4,4);

参考文档

  • 6
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
MySQLEXPLAIN命令用于解析查询语句的执行计划和性能优化。通过分析查询语句的执行计划,我们可以了解MySQL是如何执行查询的,进而进行调优和优化。 在MySQL官方文档中,你可以找到关于EXPLAIN命令的详细说明和解释器输出的含义。官方文档提供了对每个输出列的解释和示例,帮助你理解查询执行计划的各个方面。 在引用中的示例中,我们使用EXPLAIN命令解析了一个查询语句。通过这个示例,你可以了解到如何使用EXPLAIN命令来查看查询的执行计划,并理解查询执行计划的输出。 在引用中的示例中,我们使用EXPLAIN命令解析了一个带有ORDER BY和LIMIT子句的查询语句。通过这个示例,你可以了解到在查询中使用随机排序和限制结果集的影响。 总之,MySQLEXPLAIN命令是一个非常有用的工具,可以帮助我们理解和优化查询语句的执行计划。通过分析EXPLAIN输出,我们可以确定查询是否使用了正确的索引、是否存在潜在的性能问题以及如何改进查询性能。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [MYSQL explain详解](https://blog.csdn.net/asd051377305/article/details/113979657)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] - *3* [Mysql explain 参数解析(转载)](https://blog.csdn.net/Rouemm/article/details/123233601)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

码农小李子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值