 |
+------------------------+---------------------------------------------------+

"Extra" Column
--------------

This column consists of one or more of the following values, separated by ';'

Note that some of these values are detected after the optimization phase.

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.

+------------------------+---------------------------------------------------+
| Value                  | Description                                       |
+------------------------+---------------------------------------------------+
| const row not found    | The table was a system table (a table with        |
|                        | should exactly one row), but no row was found.    |
+------------------------+---------------------------------------------------+
| Distinct               | If distinct optimization (remove duplicates) was  |
|                        | used. This is marked only for the last table in   |
|                        | the SELECT.                                       |
+------------------------+---------------------------------------------------+
| Full scan on NULL key  | The table is a part of the sub query and if the   |
|                        | value that is used to match the sub query will    |
|                        | be NULL, we will do a full table scan.            |
+------------------------+---------------------------------------------------+
| Impossible HAVING      | The used HAVING clause is always false so the     |
|                        | SELECT will return no rows.                       |
+------------------------+---------------------------------------------------+
| Impossible WHERE       | The used WHERE clause is always false so the      |
| noticed after reading  | SELECT will return no rows. This case was         |
| const tables.          | detected after we had read all 'const' tables     |
|                        | and used the column values as constant in the     |
|                        | WHERE clause. For example: WHERE const_column=5   |
|                        | and const_column had a value of 4.                |
+------------------------+---------------------------------------------------+
| Impossible WHERE       | The used WHERE clause is always false so the      |
|                        | SELECT will return no rows. For example: WHERE    |
|                        | 1=2                                               |
+------------------------+---------------------------------------------------+
| No matching min/max    | During early optimization of MIN()/MAX() values   |
| row                    | it was detected that no row could match the       |
|                        | WHERE clause. The MIN()/MAX() function will       |
|                        | return NULL.                                      |
+------------------------+------------------------------------Šė