EXPLAIN ... SELECT
참조 : https://mariadb.com/kb/en/library/explain/
https://mariadb.com/kb/en/library/semi-join-materialization-strategy/
아래는 위의 사이트를 참조해서 내가 보기 좋게 수정한 것임.
EXPLAIN ... SELECT
Column name | Description |
---|
id | 순서 테이블이 조인되는 순서 번호. (Sequence number that shows in which order tables are joined.) |
select_type | select 종류 . (What kind of SELECT the table comes from.)
Value | Description |
---|
DEPENDENT SUBQUERY | The SUBQUERY is DEPENDENT . | DEPENDENT UNION | The UNION is DEPENDENT . | DERIVED | The SELECT is DERIVED from the PRIMARY . | MATERIALIZED | The SUBQUERY is MATERIALIZED . | PRIMARY | The SELECT is a PRIMARY one. | SIMPLE | The SELECT is a SIMPLE one. | SUBQUERY | The SELECT is a SUBQUERY of the PRIMARY . | UNCACHEABLE SUBQUERY | The SUBQUERY is UNCACHEABLE . | UNCACHEABLE UNION | The UNION is UNCACHEABLE . | UNION | The SELECT is a UNION of the PRIMARY . | UNION RESULT | The result of the UNION |
|
table | 테이블의 별칭 이름입니다. 서브 쿼리의 구체화 된 임시 테이블은 <subquery #> Alias name of table. Materialized temporary tables for sub queries are named <subquery#> |
type | 테이블에 액세스하는 방법에 대한 정보를 포함. How rows are found from the table (join type).
|
possible_keys | 테이블의 행을 찾는 데 사용할 수있는 테이블의 키 keys in table that could be used to find rows in the table |
key | 행을 검색하는 데 사용되는 키의 이름입니다. NULL 키가 사용되지 않았습니다. The name of the key that is used to retrieve rows. NULL is no key was used. |
key_len | 사용 된 KEY의 바이트 (다중 열 키의 일부만 사용하는지 보여줍니다). How many bytes of the key that was used (shows if we are using only parts of the multi-column key). |
ref | 키 값으로 사용되는 참조입니다. The reference that is used to as the key value. |
rows | 각 키 조회에 대해 표에서 얼마나 많은 행을 찾을지 추정합니다. An estimate of how many rows we will find in the table for each key lookup. |
Extra
(추가) | 이 조인에 대한 추가 정보. (Extra information about this join.)
The optimization phase can do the following changes to the WHERE clause: - Add the expressions from the
ON and USING clauses to the WHERE clause. - Constant propagation: If there is
column=constant , replace all column instances with this constant. - Replace all columns from '
const ' tables with their values. - Remove the used key columns from the
WHERE (as this will be tested as part of the key lookup). - Remove impossible constant sub expressions. For example
WHERE '(a=1 and a=2) OR b=1' becomes 'b=1' . - Replace columns with other columns that has identical values: Example:
WHERE a=b and a=c may be treated as 'WHERE a=b and a=c and b=c' . - Add extra conditions to detect impossible row conditions earlier. This happens mainly with
OUTER JOIN where we in some cases add detection of NULL values in the WHERE (Part of 'Not exists ' optimization). This can cause an unexpected 'Using where ' in the Extra column. - For each table level we remove expressions that have already been tested when we read the previous row. Example: When joining tables
t1 with t2 using the following WHERE 't1.a=1 and t1.a=t2.b' , we don't have to test 't1.a=1' when checking rows in t2 as we already know that this expression is true.
|
EXPLAIN SELECT * FROM employees e JOIN salaries s ON e.emp_no = s.emp_no;
