{code lang=sql]
mysql> EXPLAIN SELECT a.id, a.name, COUNT(b.id) AS count_files FROM users a INNER JOIN photos b ON a.id = b.user_id GROUP BY a.id, a.name HAVING COUNT(b.id) > 5;
+----+-------------+-------+------+---------------+------------+---------+------------+-------+---------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+------+---------------+------------+---------+------------+-------+---------------------------------+
| 1 | SIMPLE | a | ALL | PRIMARY | NULL | NULL | NULL | 20531 | Using temporary; Using filesort |
| 1 | SIMPLE | b | ref | usernummer | usernummer | 3 | users.a.id | 2 | |
+----+-------------+-------+------+---------------+------------+---------+------------+-------+---------------------------------+
2 rows in set (0.00 sec)
[/code]