SELECT COUNT(*)
FROM xf_post AS post
INNER JOIN xf_thread AS thread ON
(post.thread_id = thread.thread_id AND thread.node_id IN (3, 9, 13, 17, 43, 39, 2, 30, 18, 42, 45, 4, 33, 24, 32, 5, 7, 34, 41, 26, 10, 19, 20, 11))
INNER JOIN xf_forum AS forum ON
(forum.node_id = thread.node_id AND forum.find_new = 1)
LEFT JOIN xf_thread_read AS thread_read ON
(thread_read.thread_id = thread.thread_id AND thread_read.user_id = ?)
LEFT JOIN xf_forum_read AS forum_read ON
(forum_read.node_id = thread.node_id AND forum_read.user_id = ?)
WHERE post.post_date > ?
AND post.message_state = 'visible'
AND post.post_date > GREATEST(
IF (thread_read.thread_read_date IS NULL, 0, thread_read.thread_read_date),
IF (forum_read.forum_read_date IS NULL, 0, forum_read.forum_read_date)
)
Params: 2819, 2819, 1388301277
Run Time: 3.932912
Select Type Table Type Possible Keys Key Key Len Ref Rows Extra
SIMPLE forum ALL PRIMARY 25 Using where
SIMPLE thread ref PRIMARY,node_id_last_post_date,node_id_sticky_state_last_post node_id_last_post_date 4 aspies_xen.forum.node_id 81 Using index
SIMPLE thread_read eq_ref user_id_thread_id,thread_id user_id_thread_id 8 const,aspies_xen.thread.thread_id 1
SIMPLE forum_read eq_ref user_id_node_id,node_id user_id_node_id 8 const,aspies_xen.forum.node_id 1
SIMPLE post ref thread_id_post_date,thread_id_position,unread_post_count_post_date thread_id_position 4 aspies_xen.thread.thread_id 6 Using where