我有这个查询运行以从 phpbb3 获取 5 个最近的帖子/主题。该论坛拥有超过 180,000 条记录。当前查询平均需要 20 秒才能完成。有什么想法可以优化它以使其更快吗?
SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
FROM phpbb_topics t, phpbb_forums f, phpbb_posts p, phpbb_users u
WHERE t.topic_id = p.topic_id AND
f.forum_id = t.forum_id AND
t.forum_id != 4 AND
t.topic_status <> 2 AND
p.post_id = t.topic_last_post_id AND
p.poster_id = u.user_id
ORDER BY p.post_id DESC LIMIT 5;