I have the following queries (as examples):
SELECT articles.*
FROM articles
WHERE articles.forumid IN (2,8,118,9,61,58,34,114,112,113,125,124,4,134,42,14,71,181)
ORDER BY lastpost DESC
LIMIT 0, 30
SELECT articles.*
FROM articles
WHERE articles.forumid IN (2,8,118,9,61,58,34,114,112,113,125,124,4,134,42,14,71,181)
AND NOT deleted
ORDER BY lastpost DESC
LIMIT 0, 30
SELECT articles.*, IF(articles.forumid = 8, articles.sticky, 0) AS show_sticky
FROM articles
WHERE articles.forumid IN (8)
ORDER BY show_sticky DESC, lastpost DESC
LIMIT 0, 30
I have an index on the articles table as such: (forumid, deleted, lastpost, sticky). None of these queries will use this index. When I do EXPLAIN SELECT
they all just do USING WHERE; USING FILESORT. I tried adding the USE INDEX
hint and the query still refuses to speed up. I've tried modifying the order of the columns in the index about 5 times already.