I have the following query, which always makes the whole website down becuase it's "waiting for table level lock":
/*IPS\Patterns\_ActiveRecordIterator::count:246*/ SELECT SQL_CALC_FOUND_ROWS forums_posts . * , forums_topics . *
FROM `forums_posts`
LEFT JOIN `forums_topics` ON forums_posts.topic_id = forums_topics.tid
LEFT JOIN `core_permission_index` ON core_permission_index.app = 'forums'
AND core_permission_index.perm_type = 'forum'
AND core_permission_index.perm_type_id = forums_topics.forum_id
LEFT JOIN `forums_forums` ON forums_topics.forum_id = forums_forums.id
WHERE (
NULLIF( forums_topics.moved_to, '' ) IS NULL
)
AND (
forums_forums.password IS NULL
OR (
(
FIND_IN_SET( 2, forums_forums.password_override )
)
)
)
AND (
forums_forums.can_view_others =1
OR forums_topics.starter_id IS NULL
)
AND forums_forums.min_posts_view <=0
AND queued =0
AND forums_topics.approved =1
AND (
(
(
FIND_IN_SET( 2, perm_2 )
)
)
OR perm_2 = '*'
)
ORDER BY post_date DESC
LIMIT 185725 , 25
Is there anything I can do to improve the performance of this query instead of killing the proccess/ wait 10 minutes untils it's finished?