Our environment: Drupal+MySQL
Examining the query log indicates that the following query, originating from Drupal core's node_load function is taking considerable amount of time.
EXPLAIN on the node_load query reveals that the index is not used on the USER table.
mysql> explain SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed,
n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title,
r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data
FROM xyz_node n
INNER JOIN xyz_users u ON n.uid = u.uid
INNER JOIN xyz_node_revisions r ON r.vid = n.vid;
+----+-------------+-------+--------+---------------+---------+---------+--------------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+--------+---------------+---------+---------+--------------+------+-------------+
| 1 | SIMPLE | u | ALL | PRIMARY | NULL | NULL | NULL | 181 | |
| 1 | SIMPLE | n | ref | vid,uid | uid | 4 | xyz.u.uid | 9 | Using where |
| 1 | SIMPLE | r | eq_ref | PRIMARY | PRIMARY | 4 | xyz.n.vid | 1 | |
+----+-------------+-------+--------+---------------+---------+---------+--------------+------+-------------+
Any idea what could be going on, and how i could force MYSQL to use Index on this query?