Posted by peter

Have you ever seen index which refused to be used even if there is every reason for it to work (from the glance view):

SQL:
  1. mysql> EXPLAIN SELECT * FROM article WHERE article_id=10;
  2. +----+-------------+---------+------+---------------+------+---------+------+-------+-------------+
  3. | id | select_type | TABLE   | type | possible_keys | KEY  | key_len | ref  | rows  | Extra       |
  4. +----+-------------+---------+------+---------------+------+---------+------+-------+-------------+
  5. 1 | SIMPLE      | article | ALL  | PRIMARY       | NULL | NULL    | NULL | 93490 | USING WHERE |
  6. +----+-------------+---------+------+---------------+------+---------+------+-------+-------------+
  7. 1 row IN SET (0.00 sec)

Why on the earth index would not be used you would think, even if MySQL is mentioning it in "possible keys" ? Should you try to force it ?

[read more...]