mysql> explain SELECT post.postid, post.pagetext, post.dateline AS date, thread.forumid, thread.title as thread_title, thread.threadid, forum.forumid, forum.title as forum_title FROM post as post LEFT JOIN thread as thread on (post.threadid = thread.threadid) LEFT JOIN forum as forum on (thread.forumid = forum.forumid) WHERE thread.forumid NOT IN(69,114,108,143,148,95,111,144,3,38,146,109,152,41,39,112,42,43,40,46,45,44,36,37,115,139,140,145,147,154,155,153,69,114,109,40,115,153) AND forum.forumid NOT IN(69,114,108,143,148,95,111,144,3,38,146,109,152,41,39,112,42,43,40,46,45,44,36,37,115,139,140,145,147,154,155,153,69,114,109,40,115,153) ORDER BY postid DESC LIMIT 1;
+----+-------------+--------+--------+-------------------------------------+----------+---------+-------------------------+--------+----------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+--------+--------+-------------------------------------+----------+---------+-------------------------+--------+----------------------------------------------+
| 1 | SIMPLE | thread | range | PRIMARY,forumid,forumid_2,forumid_3 | forumid | 2 | NULL | 168018 | Using where; Using temporary; Using filesort |
| 1 | SIMPLE | forum | eq_ref | PRIMARY | PRIMARY | 2 | forum_h.thread.forumid | 1 | Using where |
| 1 | SIMPLE | post | ref | threadid | threadid | 4 | forum_h.thread.threadid | 8 | |
+----+-------------+--------+--------+-------------------------------------+----------+---------+-------------------------+--------+----------------------------------------------+
3 rows in set (0.00 sec)
mysql> explain SELECT post.postid, post.pagetext, post.dateline AS date, thread.forumid, thread.title as thread_title, thread.threadid, (SELECT title FROM forum WHERE forumid=thread.forumid) as forum_title FROM post as post LEFT JOIN thread as thread on (post.threadid = thread.threadid) WHERE thread.forumid NOT IN(69,114,108,143,148,95,111,144,3,38,146,109,152,41,39,112,42,43,40,46,45,44,36,37,115,139,140,145,147,154,155,153,69,114,109,40,115,153) ORDER BY postid DESC LIMIT 1;
+----+--------------------+--------+--------+-------------------------------------+---------+---------+------------------------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+--------------------+--------+--------+-------------------------------------+---------+---------+------------------------+------+-------------+
| 1 | PRIMARY | post | index | threadid | PRIMARY | 4 | NULL | 1 | |
| 1 | PRIMARY | thread | eq_ref | PRIMARY,forumid,forumid_2,forumid_3 | PRIMARY | 4 | forum_h.post.threadid | 1 | Using where |
| 2 | DEPENDENT SUBQUERY | forum | eq_ref | PRIMARY | PRIMARY | 2 | forum_h.thread.forumid | 1 | |
+----+--------------------+--------+--------+-------------------------------------+---------+---------+------------------------+------+-------------+
3 rows in set (0.00 sec)