Search code examples
mysqlselectindexingkeyexplain

MYSQL query EXPLAIN SELECT


EXPLAIN SELECT results for some tables has:

             type   possible_keys   key       Extra
table1       ref    fl              fl        Using where
table2       ref    PRIMARY,variant variant   Using where; Using index

If would like to clarify that both tables uses index by the 'key' column, however i cannot see 'Using index' for the table1??? Should I care about this?


Solution

  • As documented under EXPLAIN Output Format:

    EXPLAIN Extra Information

    The Extra column of EXPLAIN output contains additional information about how MySQL resolves the query. The following list explains the values that can appear in this column.

    [ deletia ]

    • Using index

      The column information is retrieved from the table using only information in the index tree without having to do an additional seek to read the actual row. This strategy can be used when the query uses only columns that are part of a single index.

    If Using index is not present, an index may still be used to locate records but then MySQL may be fetching the full record to retrieve column data.