When reading a MySQL Query Execution Plan (QEP) produced by the
EXPLAIN command, generally one of the first
observations is to validate an index is being used per table
(i.e. per row of output). In MySQL, this is observed with the
key column.
In the following two simple single table examples we see the use of the PRIMARY key. To the untrained eye this may lead to assume that the right index is being used.
Example 1
+----+-------------+----------------+-------+---------------+---------+---------+------+------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+----------------+-------+---------------+---------+---------+------+------+-------------+ | 1 | SIMPLE | txxxxxxxxxxxx | index | NULL | PRIMARY | 4 | NULL | 100 | Using …[Read more]