EXPLAIN SELECT¹®¿¡ ÀÇÇØ¼­ Ãâ·ÂµÇ´Â °¢ ÇʵåÀÇ ÀǹÌ


mysql> explain select * from employees;
+----+-------------+-----------+------+---------------+------+---------+------+------+-------+
| id | select_type | table     | type | possible_keys | key  | key_len | ref  | rows | Extra |
+----+-------------+-----------+------+---------------+------+---------+------+------+-------+
|  1 | SIMPLE      | employees | ALL  | NULL          | NULL |    NULL | NULL |    4 |       |
+----+-------------+-----------+------+---------------+------+---------+------+------+-------+
1 row in set (0.00 sec)

mysql> 

EXPLAIN SELECT¿¡ ÀÇÇØ¼­ Ãâ·ÂµÇ´Â °¢ ÇʵåÀÇ Àǹ̴ ´ÙÀ½°ú °°´Ù.

id  	SELECT identifier, the sequential number of this SELECT within the query
select_type  
	Type of SELECT clause, which can be any of the following
	  SIMPLE	 Simple SELECT(without UNIONs or subqueries)
	  PRIMARY 	 Outermost SELECT
	  UNION	 Second and futher UNION SELECTs.
	  DEPENDENT UNION  Second and futher UNION SELECTSs, dependent on outer subquery
	  SUBQUERY	 First SELECT in subquery.
	  DEPENDENT SUBQUERY  first SELECT, dependent on outer subquery.
	  DERIVED	 Derived table SELECT.
table	The table to which the row of outer refers.
type	The join type. The different join types are listed here, ordered from best to worst type:
	  system	The table has only one row(= system table). This is a special case of the const join type.
	  const	The table has at most one matching row, which will be read at the start of the query
	  eq_ref 	One row will be read from this table for each combination of rows from the previous tables.
	  ref	All rows with matching index values will be read from this table for each combination of rows from the previous tables.
		ref is used if the join uses only a leftmost prefix of the key, or if the key is not UNIQUE or a PRIMARY KEY.
	  range	Only rows that are in a given range will be retrived, using an index to select the rows.
		The key column indicates which index is used.
	  index	This is the same as ALL, except that only the index tree is scanned.
		This is usually faster than ALL.
	  ALL	A full table scan will be done for each combination of rows from the previous tables.
possible_keys
	The possible_keys column indicate which indexes MYSQL could use to find the rows in this table.
key	The key column indicates the key (index) that MySQL actually decided to use.
	The key is NULL if no index was chosen.
key_len	The key_len column indicates the length of the key that MySQL decided to use.
	The length is NULL if the key is NULL.
ref	The ref column shows which columns or constants are used with the key to select rows from the table.
rows	The rows column indicates the number of rows MySQL belives it must examine to execute the query.
Extra	This column contains additional information of row how MySQL will resolve the query.
	here is an explanation of the different text strings that can be found in this column:
	  distinct		MySQL will not continue searching for more rows for the current row combination after it has found the first matching row.
	  Not exists	MySQL was able to do a LEFT JOIN optimisation on the query and 
			will not examine more rows in this table for the previous row combination 
			after it finds one row that matches the LEFT JOIN criteria.
	  range checked for each record (index map: #)
			MySQL didn't find a real good index to use.
	  Using filesort	MySQL will need to do an extra pass to find out how to retrieve the rows in sorted order.
	  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.
	  using temporary	To resolve the query MySQL will need to create a temporary table to hold the result.
	  using where	A WHERE clause will be used to restrict which rows will be matched against the next table or sent to the client.


explain ¹®