Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
This column shows which columns or constants from
preceding tables are being used to look up values in the index named in
the key column. Here’s an example
that shows a combination of join conditions and aliases. Notice that the
ref column reflects how the film table is aliased as f in the query text:
mysql>EXPLAIN->SELECT STRAIGHT_JOIN f.film_id->FROM sakila.film AS f->INNER JOIN sakila.film_actor AS fa->ON f.film_id=fa.film_id AND fa.actor_id = 1->INNER JOIN sakila.actor AS a USING(actor_id);...+-------+...+--------------------+---------+------------------------+... ...| table |...| key | key_len | ref |... ...+-------+...+--------------------+---------+------------------------+... ...| a |...| PRIMARY | 2 | const |... ...| f |...| idx_fk_language_id | 1 | NULL |... ...| fa |...| PRIMARY | 4 | const,sakila.f.film_id |... ...+-------+...+--------------------+---------+------------------------+...