| All |
A full table scan usually means that MySQL must scan the entire table, from beginning to end, to find the desired line. There is an exception to this, such as using limit in a query, or displaying "using Distinct/not exists" in the extra column. |
| Index |
This is the same as a full-table scan, except that the MySQL scan table is in indexed order instead of rows. Its main advantage is to avoid sorting, and the biggest disadvantage is to assume the cost of reading the entire table in indexed order. This usually means that if the rows are accessed in random order, the overhead will be very large. If you see "Using index" in the extra column, it means that MySQL is using the overwrite index, which scans only the indexed data, not each row in the index order. It costs a lot less than full table scans in indexed order. |
| Range |
Range Scan a restricted index scan that starts at a certain point in the index and returns rows that match that value. This is better than a full index scan because it does not need to traverse all indexes. The obvious range scan is a query with a between or a > in the WHERE clause. When MySQL uses an index to find a range of values, such as in () and or lists, it is also displayed as a range scan. However, the two are actually quite different types of access, with major differences in performance. The cost of such a scan is equivalent to the index type. |
| Ref |
This is an indexed access (sometimes called an index lookup), which returns all matches to a single worthwhile row. However, it may find multiple rows that match the criteria, so it is a mixture of lookups and scans. This type of index access occurs only if a non-unique prefix that uses a non-unique index or a uniqueness index is used. It is called ref because the index is compared to a reference value. This reference value is either a constant or a result value from the previous table in a multi-sheet query. Ref_or_null is a variant above ref, which means that MySQL must be the result of the initial lookup. |
| Eq_ref |
With this index lookup, MySQL knows that only one record that matches the criteria is returned. This access method can be seen when MySQL uses a primary key or a unique index lookup, which compares them to a reference value. MySQL sits very well for this type of access, because it knows that there is no need to estimate the range of matching rows or to continue looking after matching rows are found. |
| Const, System |
When MySQL can optimize a part of a query and convert it to a constant, it uses these types of access. For example, if you select the primary key for this row by placing the primary key of a row in the WHERE clause, MySQL can convert the query to a constant. You can then effectively remove the table from the join execution. |
| Null |
This access means that MySQL can break down query statements during the optimization phase, or even need to access tables or indexes at the execution stage. For example, selecting the minimum value from an index column can be done by looking up the index separately, without having to access the table when it is executed. |