SELECT COUNT(*)
FROM xf_thread AS thread
WHERE (thread.node_id = 38) AND (thread.sticky = 0) AND (thread.discussion_state IN ('visible'))

Run Time: 0.000153

Select Type

Table

Type

Possible Keys

Key

Key Len

Ref

Rows

Extra

SIMPLE

thread

ref

node_id_last_post_date,node_id_sticky_state_last_post

node_id_sticky_state_last_post

6

const,const,const

1

Using where; Using index

SELECT thread.*
,
user.*, IF(user.username IS NULL, thread.username, user.username) AS username,
NULL AS thread_read_date,
0 AS thread_is_watched,
0 AS user_post_count
FROM xf_thread AS thread
LEFT JOIN xf_user AS user ON
(user.user_id = thread.user_id)
WHERE (thread.node_id = 38) AND (thread.sticky = 0) AND (thread.discussion_state IN ('visible'))
ORDER BY thread.last_post_date DESC
LIMIT 20

Run Time: 0.000256

Select Type

Table

Type

Possible Keys

Key

Key Len

Ref

Rows

Extra

SIMPLE

thread

ref

node_id_last_post_date,node_id_sticky_state_last_post

node_id_last_post_date

4

const

1

Using where

SIMPLE

user

eq_ref

PRIMARY

PRIMARY

4

questies_xenforo.thread.user_id

1

SELECT thread.*
,
user.*, IF(user.username IS NULL, thread.username, user.username) AS username,
NULL AS thread_read_date,
0 AS thread_is_watched,
0 AS user_post_count
FROM xf_thread AS thread
LEFT JOIN xf_user AS user ON
(user.user_id = thread.user_id)
WHERE (thread.node_id = 38) AND (thread.sticky = 1) AND (thread.discussion_state IN ('visible'))
ORDER BY thread.last_post_date DESC