Please ensure this page remains unpublished.

Documentation on reading EXPLAIN statements.

Running MySQL 4.0.25

EXPLAIN SELECT DISTINCT i.sid, i.type FROM search_index i INNER JOIN node n ON n.nid = i.sid INNER JOIN users u ON n.uid = u.uid WHERE n.status = 0 AND (i.word LIKE 'search')

tabletypepossible_keyskeykey_lenrefrowsExtra
irangesid,wordword504314Using where; Using temporary
neq_refPRIMARY,uid,node_status_typePRIMARY4i.sid1Using where; Distinct
ueq_refPRIMARYPRIMARY4n.uid1Using where; Using index; Distinct


EXPLAIN SELECT i.type, i.sid, SUM(i.score/t.count) AS score FROM search_index i INNER JOIN node n ON n.nid = i.sid INNER JOIN users u ON n.uid = u.uid INNER JOIN search_total t ON i.word = t.word WHERE n.status = 0 AND (i.word LIKE 'search') GROUP BY i.type, i.sid ORDER BY score DESC LIMIT 0, 10

tabletypepossible_keyskeykey_lenrefrowsExtra
irangesid,wordword504314Using where; Using temporary; Using filesort
neq_refPRIMARY,uid,node_status_typePRIMARY4i.sid1Using where
ueq_refPRIMARYPRIMARY4n.uid1Using where; Using index
teq_refPRIMARYPRIMARY50i.word1


EXPLAIN SELECT DISTINCT i.sid, i.type FROM search_index i INNER JOIN node n ON n.nid = i.sid INNER JOIN users u ON n.uid = u.uid WHERE n.status = 0 AND (i.word LIKE 'search1' OR i.word LIKE 'search2')

tabletypepossible_keyskeykey_lenrefrowsExtra
irangesid,wordword502Using where; Using temporary
neq_refPRIMARY,uid,node_status_typePRIMARY4i.sid1Using where; Distinct
ueq_refPRIMARYPRIMARY4n.uid1Using where; Using index; Distinct


EXPLAIN SELECT i.type, i.sid, SUM(i.score/t.count) AS score FROM search_index i INNER JOIN node n ON n.nid = i.sid INNER JOIN users u ON n.uid = u.uid INNER JOIN search_total t ON i.word = t.word WHERE n.status = 0 AND (i.word LIKE 'search1' OR i.word LIKE 'search2') GROUP BY i.type, i.sid ORDER BY score DESC LIMIT 0, 10

tabletypepossible_keyskeykey_lenrefrowsExtra
irangesid,wordword502Using where; Using temporary; Using filesort
neq_refPRIMARY,uid,node_status_typePRIMARY4i.sid1Using where
ueq_refPRIMARYPRIMARY4n.uid1Using where; Using index
teq_refPRIMARYPRIMARY50i.word1


EXPLAIN SELECT COUNT(a.uid) AS hits, a.uid, u.name, a.hostname, SUM(a.timer) AS total, ac.aid FROM accesslog a LEFT JOIN access ac ON ac.type = '0' AND LOWER(a.hostname) LIKE (ac.mask) LEFT JOIN users u ON a.uid = u.uid GROUP BY a.hostname ORDER BY hits DESC LIMIT 0, 10

tabletypepossible_keyskeykey_lenrefrowsExtra
aALL421049Using temporary; Using filesort
acALL40
ueq_refPRIMARYPRIMARY4a.uid1


EXPLAIN SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, l.last_comment_timestamp AS last_post, l.comment_count FROM node n INNER JOIN node_comment_statistics l ON n.nid = l.nid INNER JOIN users u ON n.uid = u.uid LEFT JOIN comments c ON n.nid = c.nid AND (c.status = 0 OR c.status IS NULL) WHERE n.status = 0 AND (n.uid = 0 OR c.uid = 0) ORDER BY last_post DESC LIMIT 0, 10

tabletypepossible_keyskeykey_lenrefrowsExtra
nrefPRIMARY,uid,node_status_typenode_status_type4const561Using where; Using temporary; Using filesort
leq_refPRIMARYPRIMARY4n.nid1
ueq_refPRIMARYPRIMARY4n.uid1Using where
creflidlid4n.nid4Using where; Distinct


EXPLAIN SELECT DISTINCT i.sid, i.type FROM search_index i INNER JOIN node n ON n.nid = i.sid INNER JOIN users u ON n.uid = u.uid WHERE n.status = 0 AND (i.word LIKE 'search1' OR i.word LIKE 'search2' OR i.word LIKE 'search3')

tabletypepossible_keyskeykey_lenrefrowsExtra
irangesid,wordword503Using where; Using temporary
neq_refPRIMARY,uid,node_status_typePRIMARY4i.sid1Using where; Distinct
ueq_refPRIMARYPRIMARY4n.uid1Using where; Using index; Distinct


EXPLAIN SELECT i.type, i.sid, SUM(i.score/t.count) AS score FROM search_index i INNER JOIN node n ON n.nid = i.sid INNER JOIN users u ON n.uid = u.uid INNER JOIN search_total t ON i.word = t.word WHERE n.status = 0 AND (i.word LIKE 'search1' OR i.word LIKE 'search2' OR i.word LIKE 'search3') GROUP BY i.type, i.sid ORDER BY score DESC LIMIT 0, 10

tabletypepossible_keyskeykey_lenrefrowsExtra
irangesid,wordword503Using where; Using temporary; Using filesort
neq_refPRIMARY,uid,node_status_typePRIMARY4i.sid1Using where
ueq_refPRIMARYPRIMARY4n.uid1Using where; Using index
teq_refPRIMARYPRIMARY50i.word1


EXPLAIN SELECT u.*, s.* FROM users u INNER JOIN sessions s ON u.uid = s.uid WHERE s.sid = '0' AND u.status < 1 LIMIT 0, 10

Comment
Impossible WHERE noticed after reading const tables


EXPLAIN SELECT DISTINCT m.*, r.*, u.name, u.uid FROM cvs_messages m INNER JOIN cvs_files f ON m.cid = f.cid INNER JOIN cvs_repositories r ON m.rid = r.rid INNER JOIN users u ON m.uid = u.uid ORDER BY m.created DESC LIMIT 0, 10

tabletypepossible_keyskeykey_lenrefrowsExtra
mALLPRIMARY,uid,cid,rid24954Using temporary; Using filesort
frefcidcid4m.cid3Using index
rALLPRIMARY2Using where
ueq_refPRIMARYPRIMARY4m.uid1


EXPLAIN SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, l.last_comment_timestamp AS last_post, l.comment_count FROM node n INNER JOIN users u ON n.uid = u.uid INNER JOIN node_comment_statistics l ON n.nid = l.nid WHERE n.status = 0 ORDER BY last_post DESC LIMIT 0, 10

tabletypepossible_keyskeykey_lenrefrowsExtra
nrefPRIMARY,uid,node_status_typenode_status_type4const561Using where; Using temporary; Using filesort
ueq_refPRIMARYPRIMARY4n.uid1Using where
leq_refPRIMARYPRIMARY4n.nid1


EXPLAIN SELECT COUNT(a.uid) AS hits, a.uid, u.name, a.hostname, SUM(a.timer) AS total, ac.aid FROM accesslog a LEFT JOIN access ac ON ac.type = '0' AND LOWER(a.hostname) LIKE (ac.mask) LEFT JOIN users u ON a.uid = u.uid GROUP BY a.hostname ORDER BY total DESC LIMIT 0, 10

tabletypepossible_keyskeykey_lenrefrowsExtra
aALL421049Using temporary; Using filesort
acALL40
ueq_refPRIMARYPRIMARY4a.uid1


EXPLAIN SELECT COUNT(DISTINCT(n.nid)) FROM node n LEFT JOIN comments c ON n.nid = c.nid AND (c.status = 0 OR c.status IS NULL) WHERE n.status = 0 AND (n.uid = 1 OR c.uid = 1)

tabletypepossible_keyskeykey_lenrefrowsExtra
nrefuid,node_status_typenode_status_type4const561Using where
creflidlid4n.nid4Using where