看懂mysql执行计划–官方文档

原文地址:https://dev.mysql.com/doc/refman/5.7/en/explain-output.html9.8.2EXPLAIN Output FormatTheEXPLAINstatement provides information about the execution plan for aSELECTstatement.EXPLAINreturns a row of information for each table used in

原文地址:https://dev.mysql.com/doc/refman/5.7/en/explain-output.html

Thestatement provides information about the execution plan for astatement.

returns a row of information for each table used in thestatement. It lists the tables in the output in the order that MySQL would read them while processing the statement. MySQL resolves all joins using a nested-loop join method. This means that MySQL reads a row from the first table,and then finds a matching row in the second table,the third table,and so on. When all tables are processed,MySQL outputs the selected columns and backtracks through the table list until a table is found for which there are more matching rows. The next row is read from this table and the process continues with the next table.

Before MySQL 5.7.3,when thekeyword is used,produces extra information that can be viewed by issuing astatement following thestatement.also displays thecolumn. See. As of MySQL 5.7.3,extended output is enabled by default and thekeyword is unnecessary.

You cannot use theandkeywords together in the samestatement. In addition,neither of these keywords can be used together with theoption. (causesto display extended and partition information automatically; usinghas no effect onoutput.)

Output Columns

  • Join Types

  • Extra Information

  • Output Interpretation

  • EXPLAIN Output Columns

    This section describes the output columns produced by. Later sections provide additional information about theandcolumns.

    Each output row fromprovides information about one table. Each row contains the values summarized in,and described in more detail following the table. Column names are shown in the table's first column; the second column provides the equivalent property name shown in the output whenis used.

    Table9.1EXPLAIN Output Columns

    identifiertype <div class="note">
    <div class="admon-title">Note

    JSON properties which areare not displayed in JSON-formattedoutput.

    (JSON name:)

    Theidentifier. This is the sequential number of thewithin the query. The value can beif the row refers to the union result of other rows. In this case,thecolumn shows a value likeM,N>to indicate that the row refers to the union of the rows withvalues ofMandN.

  • (JSON name: none)

    The type of,which can be any of those shown in the following table. A JSON-formattedexposes thetype as a property of a,unless it isor. The JSON names (where applicable) are also shown in the table.

    Value </tr>
    <tr>
    <td scope="row"><code class="literal">PRIMARY
    </td>
    <td>None</td>
    <td>Outermost<a class="link" title="14.2.9SELECT Syntax" href="https://dev.mysql.com/doc/refman/5.7/en/select.html"&gt;<code class="literal">SELECT

    </td>

    </tr>
    <tr>
    <td scope="row"><a class="link" title="14.2.9.3UNION Syntax" href="https://dev.mysql.com/doc/refman/5.7/en/union.html"&gt;<code class="literal">UNION
    </td>
    <td>None</td>
    <td>Second or later<a class="link" title="14.2.9SELECT Syntax" href="https://dev.mysql.com/doc/refman/5.7/en/select.html"&gt;<code class="literal">SELECT
    statement in a<a class="link" title="14.2.9.3UNION Syntax" href="https://dev.mysql.com/doc/refman/5.7/en/union.html"&gt;<code class="literal">UNION

    </td>

    </tr>
    <tr>
    <td scope="row"><code class="literal">DEPENDENT UNION
    </td>
    <td>
    <code class="literal">dependent
    (<code class="literal">true
    )</td>
    <td>Second or later<a class="link" title="14.2.9SELECT Syntax" href="https://dev.mysql.com/doc/refman/5.7/en/select.html"&gt;<code class="literal">SELECT
    statement in a<a class="link" title="14.2.9.3UNION Syntax" href="https://dev.mysql.com/doc/refman/5.7/en/union.html"&gt;<code class="literal">UNION
    ,dependent on outer query</td>

    </tr>
    <tr>
    <td scope="row"><code class="literal">UNION RESULT
    </td>
    <td><code class="literal">union_result
    </td>
    <td>Result of a<a class="link" title="14.2.9.3UNION Syntax" href="https://dev.mysql.com/doc/refman/5.7/en/union.html"&gt;<code class="literal">UNION
    .</td>

  • 作者: dawei

    【声明】:永州站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

    为您推荐

    【免责声明】本站内容转载自互联网,其发布内容言论不代表本站观点,如果其链接、内容的侵犯您的权益,烦请提交相关链接至邮箱xwei067@foxmail.com我们将及时予以处理。

    Copygight © 2017-2023 https://www.0746zz.com All Rights Reserved.永州站长网

    站长:xwei067#foxmail.com(请把#换成@)

    联系我们

    联系我们

    0577-28828765

    在线咨询: QQ交谈

    邮箱: xwei067@foxmail.com

    工作时间:周一至周五,9:00-17:30,节假日休息