This join type indicates that the Index Merge optimization is used. In this case, the key  column in the output row contains a list of indexes used, and key_len  contains a list of the longest key parts for the indexes used. For more information, see Section 8.2.1.3, “Index Merge Optimization” . 

• unique_subquery 

This type replaces eq_ref  for some IN  subqueries of the following form: 

value  IN (SELECT primary_key  FROM single_table  WHERE some_expr ) 

unique_subquery  is just an index lookup function that replaces the subquery completely for better efficiency. 

• index_subquery 

This join type is similar to unique_subquery . It replaces IN  subqueries, but it works for nonunique indexes in subqueries of the following form: 

value  IN (SELECT key_column  FROM single_table  WHERE some_expr ) 

• range 

Only rows that are in a given range are retrieved, using an index to select the rows. The key  column in the output row indicates which index is used. The key_len  contains the longest key part that was used. The ref  column is NULL  for this type. 

range  can be used when a key column is compared to a constant using any of the = , <> , > , >= , < , <= , IS NULL , <=> , BETWEEN , LIKE , or IN()  operators: 

SELECT * FROM tbl_name WHERE key_column  = 10; SELECT * FROM tbl_name WHERE key_column  BETWEEN 10 and 20; SELECT * FROM tbl_name WHERE key_column  IN (10,20,30); SELECT * FROM tbl_name WHERE key_part1  = 10 AND key_part2  IN (10,20,30); 

• index 

The index  join type is the same as ALL , except that the index tree is scanned. This occurs two ways: 

•If the index is a covering index for the queries and can be used to satisfy all data required from the table, only the index tree is scanned. In this case, the Extra  column says Using index . An index- only scan usually is faster than ALL  because the size of the index usually is smaller than the table data. 

•A full table scan is performed using reads from the index to look up data rows in index order. Uses index  does not appear in the Extra  column. 

MySQL can use this join type when the query uses only columns that are part of a single index. 

• ALL 

A full table scan is done for each combination of rows from the previous tables. This is normally not good if the table is the first table not marked const , and usually very  bad in all other cases. Normally, you 

