digitalpoint
Well-known member
The query that runs to find how many threads are in a forum (every time you view a forum) is something like this...
There is not an index that can be fully utilized since no index has discussion_state in it. If your forum has a lot of threads in it and can cause noticeable speed issued with a high number of threads in a forum (more than a second to run the query).
While I've already done it on my setup, I'd suggest an index with the 3 fields: node_id, sticky, discussion_state be added to the xf_thread table for scalability reasons for others.
Code:
SELECT COUNT(*)
FROM xf_thread AS thread
WHERE (thread.node_id = 27) AND (thread.sticky = 0) AND (thread.discussion_state IN ('visible','deleted','moderated'))
There is not an index that can be fully utilized since no index has discussion_state in it. If your forum has a lot of threads in it and can cause noticeable speed issued with a high number of threads in a forum (more than a second to run the query).
While I've already done it on my setup, I'd suggest an index with the 3 fields: node_id, sticky, discussion_state be added to the xf_thread table for scalability reasons for others.