Description of the return value of the explain SQL statement performance test _ MySQL

Source: Internet
Author: User
Description of the returned value for performance test of explain SQL statements bitsCN.com

Description of the return value for performance test of explain SQL statements

The returned values of the explain SQL statement performance test are as follows:

Mysql> explain select * from table;

+ ---- + ------------- + ------- + ------ + --------------- + ------ + --------- + ------ + ------- +

| Id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |

+ ---- + ------------- + ------- + ------ + --------------- + ------ + --------- + ------ + ------- +

Table # display the tables involved in this statement

Type # This column is very important. it shows the category used by the connection and whether the index is used, reflecting the statement quality.

Possible_keys # indicates which index MySQL can use to find rows in the table

Key # displays the keys (Indexes) actually used by MySQL ). If no index is selected, the key is NULL.

Key_len # displays the key length determined by MySQL. If the key is NULL, the length is NULL. The length of the index used. The shorter the length, the better.

Ref # displays the column or constant used with the key to select rows from the table.

Rows # displays the number of rows that MySQL deems necessary for query execution.

Extra # contains detailed information about MySQL queries.

Among them, the type of Explain shows the access type, which is a more important indicator. The result values are from good to bad:

System> const> eq_ref> ref> fulltext> ref_or_null> index_merge> unique_subquery> index_subquery> range> index> ALL (excellent --> difference)

In general, make sure that the query reaches at least the range level, and it is best to reach the ref level. otherwise, performance problems may occur.

BitsCN.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.