Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand the Explain result output item of MySQL

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

What this article shares with you is about how to understand the Explain result output items of MySQL. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Mysql > explain select * from aaa\ G

* * 1. Row *

Id: 1

Select_type: SIMPLE

Table: aaa

Type: ALL

Possible_keys: NULL

Key: NULL

Key_len: NULL

Ref: NULL

Rows: 1

Extra: NULL

1 row in set (0.01 sec)

Some of the output items are explained as follows:

Select_type: represents the type of select (SIMPLE= > simple table, no table join or subquery, PRIMARY= > main query, outer query, second or subsequent query statement in UNION= > UNION, SUBQUERY= > first select in subquery)

Table; outputs the table of the result set

Possible_keys: indicates the index that may be used when querying

Key: represents the index actually used

Key_len: the length of the index field

Number of rows scanned by rows;

Extra: description and description of the implementation

Type: indicates the connection type of the table. The link types with good to poor performance are:

System= > has only one line, that is, the constant scale

Const= > there is at most one matching row in a single table, such as primary key or unique index

Eq_ref= > for each previous row, only one record is queried in this table. Simply put, primary key or unique index is used in multi-table joins.

Ref= > is similar to eq_ref, except that instead of using primay key or unique index, you use a normal index.

Ref_or_null= > is similar to ref, except that the condition contains a query for null

Index_merge= > Index merge Optimization

Unique_subquery= > in is followed by a subquery that queries the primary key field

Index_subquery= > is similar to unique_subquery, except that in is followed by a subquery that queries non-unique index fields.

Range= > query scope in a single table

Index= > for each previous row, the data is obtained by querying the index

All= > for each previous row, the data is obtained by a full table scan

The above is how to understand the Explain output items of MySQL. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report