mysql> EXPLAIN SELECT root.messageid, ( SELECT MAX(reply.senttime) FROM zeroseventwo_forummessages reply WHERE reply.touid = root.messageid OR reply.messageid = root.messageid) as replytime, root.thread FROM zeroseventwo_forummessages root WHERE root.thread = 1 ORDER BY replytime DESC; +----+--------------------+-------+------+---------------+--------+---------+-------+------+-----------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+--------------------+-------+------+---------------+--------+---------+-------+------+-----------------------------+ | 1 | PRIMARY | root | ref | thread | thread | 2 | const | 80 | Using where; Using filesort | | 2 | DEPENDENT SUBQUERY | reply | ALL | PRIMARY,touid | NULL | NULL | NULL | 318 | Using where | +----+--------------------+-------+------+---------------+--------+---------+-------+------+-----------------------------+ 2 rows in set (0.00 sec) mysql> EXPLAIN SELECT root.messageid, ( SELECT MAX(reply.senttime) FROM zeroseventwo_forummessages reply WHERE reply.touid = root.messageid ) as replytime, root.thread FROM zeroseventwo_forummessages root WHERE root.thread = 1 ORDER BY replytime DESC; +----+--------------------+-------+------+---------------+--------+---------+-----------------------+------+-----------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+--------------------+-------+------+---------------+--------+---------+-----------------------+------+-----------------------------+ | 1 | PRIMARY | root | ref | thread | thread | 2 | const | 80 | Using where; Using filesort | | 2 | DEPENDENT SUBQUERY | reply | ref | touid | touid | 5 | phpdip.root.messageid | 4 | Using where | +----+--------------------+-------+------+---------------+--------+---------+-----------------------+------+-----------------------------+ 2 rows in set (0.01 sec)