MySQL's explain

Source: Internet
Author: User
Tags mysql query

>First, Explain


Second, the value1. Id

The identity of each operation performed independently, indicating the order in which the objects were manipulated, the value of the IDs being executed first, and, if identical, the order of execution from top to bottom.

If there are no subqueries and union queries, the ID is 1. MySQL executes the query in the order of the IDs from large to small, and executes from top to bottom with the same ID.


2, Select_type

The type of each SELECT clause in the query provides a variety of types that represent how the table column references are used.

(1) Simple

Simple SELECT statement (excluding union operations or subquery operations)


(2) Primary/union

PRIMARY: The outermost select in the query (for example, if two tables are union or the outer layer of the subquery is PRIMARY, the inner operation is union)

In a union:union operation, a select in the query that is in the inner layer (the inner SELECT statement has no dependencies on the outer SELECT statement)


(3) DEPENDENT Union/unioin RESULT

DEPENDENT union:union operation, a select in the query that is in the inner layer (the inner SELECT statement has a dependency on the outer SELECT statement)

The result of the UNION result:union operation, the ID value is usually null


(4) Subquery/dependent subquery

Subquery: The first select in a subquery (if there are multiple subqueries present)

DEPENDENT subquery: The first select in a subquery, but a table that depends on the outer layer (if there are multiple subqueries present)


(5) derived/materialized

DERIVED: Driven Select subquery (sub-query in FROM clause)

Materialized: Materialized sub-query


(6) uncacheable subquery/uncacheable UNION

Uncacheable subquery: For the outer Main table, the subquery is not materialized and needs to be computed each time (time consuming operation)

Uncacheable union:union operation, the inner layer of the non-materialized subquery (similar to uncacheable subquery)


3. Table

The name, the name of the object being manipulated, usually the name of the table, or the alias of the table, or an identifier (such as a derived table, subquery, collection) that produces a temporary table for the query.


4. Type

Types of connection operations


5, partitions

Matching partition information (null for non-partitioned table values).


6, Possible_keys

Alternate index (lists the indexes that may be used)


7. Key

The index selected by the optimizer, and the common Analyze Table command allows the optimizer to correctly select the index.


8, Key_len

The length of the index key selected by the optimizer, in bytes.


9. Ref

A Reference object that represents the object that the bank is manipulating (the referenced object may be a const representation, or it may be the object that the key of the other table points to).


10. Rows

The number of tuples scanned by the query execution (this value is an estimate for InnoDB).


11, Filtered

According to the percentage of the number of tuples filtered by the data on the condition table, rows×filtered/100 can find out the number of tuples that have been filtered, that is, the actual tuple number.


12, Extra

Important supplemental information to the query plan during the execution of queries by the MySQL query optimizer.



Related Article

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.