EXPLAIN Output Format const  is used when you compare all parts of a  PRIMARY KEY  or  UNIQUE  index to constant values. In the following queries,  tbl_name  can be used as a  const  table: One row is read from this table for each combination of rows from the previous tables. Other than the system  and  const  types, this is the best possible join type. It is used when all parts of an index are used by the join and the index is a  PRIMARY KEY  or  UNIQUE NOT NULL  index. eq_ref  can be used for indexed columns that are compared using the  =  operator. The comparison value can be a constant or an expression that uses columns from tables that are read before this table. In the following examples, MySQL can use an  eq_ref  join to process  ref_table : All rows with matching index values are 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 a PRIMARY KEY  or  UNIQUE  index (in other words, if the join cannot select a single row based on the key value). If the key that is used matches only a few rows, this is a good join type. ref  can be used for indexed columns that are compared using the  =  or  <=>  operator. In the following examples, MySQL can use a  ref  join to process  ref_table : The join is performed using a  FULLTEXT  index. This join type is like  ref , but with the addition that MySQL does an extra search for rows that contain NULL  values. This join type optimization is used most often in resolving subqueries. In the following examples, MySQL can use a  ref_or_null  join to process  ref_table : See Section 8.2.1.15, “IS NULL Optimization” . 1767 • index_merge • fulltext • ref_or_null SELECT * FROM  ref_table WHERE  key_column = expr  OR  key_column  IS NULL; SELECT * FROM  ref_table  WHERE  key_column = expr ; SELECT * FROM  ref_table , other_table WHERE  ref_table . key_column = other_table . column ; SELECT * FROM  ref_table , other_table WHERE  ref_table . key_column_part1 = other_table . column AND  ref_table . key_column_part2 =1; SELECT * FROM  ref_table , other_table WHERE  ref_table . key_column = other_table . column ; SELECT * FROM  ref_table , other_table WHERE  ref_table . key_column_part1 = other_table . column AND  ref_table . key_column_part2 =1; SELECT * FROM  tbl_name  WHERE  primary_key =1; SELECT * FROM  tbl_name WHERE  primary_key_part1 =1 AND  primary_key_part2 =2; • eq_ref • ref