SHOW PROFILE for the following query: SELECT `topic`.* FROM `topics` AS `topic` LEFT OUTER JOIN `topic` AS `topic_helper` ON (`topic`.`id` = `topic_helper`.`id` AND `topic_helper`.`created_on` < `topic`.`created_on`) GROUP BY `topic`.`id` HAVING COUNT(*) < 3 ORDER BY `topic`.`created_on` DESC; +--------------------------------+----------+ | Status | Duration | +--------------------------------+----------+ | starting | 0.000021 | | Waiting for query cache lock | 0.000004 | | Waiting on query cache mutex | 0.000004 | | checking query cache for query | 0.000082 | | checking permissions | 0.000006 | | checking permissions | 0.000008 | | Opening tables | 0.000359 | | System lock | 0.000018 | | Waiting for query cache lock | 0.000004 | | Waiting on query cache mutex | 0.000025 | | init | 0.000009 | | checking permissions | 0.000004 | | checking permissions | 0.000004 | | checking permissions | 0.000003 | | checking permissions | 0.000004 | | checking permissions | 0.000003 | | checking permissions | 0.000003 | | checking permissions | 0.000091 | | optimizing | 0.000022 | | statistics | 0.000081 | | preparing | 0.000035 | | Creating tmp table | 0.000448 | | Sorting for group | 0.000009 | | executing | 0.000004 | | Copying to tmp table | 0.428565 | | Sorting result | 0.005275 | | Sending data | 0.000772 | | end | 0.000008 | | removing tmp table | 0.002753 | | end | 0.000009 | | query end | 0.000010 | | closing tables | 0.000032 | | freeing items | 0.000318 | | logging slow query | 0.000004 | | cleaning up | 0.000009 | +--------------------------------+----------+ 35 rows in set (0.00 sec)