Number of messages on each thread, ordered: select thread, count(thread) from message group by (thread) order by count(thread); +--------+---------------+ | thread | count(thread) | +--------+---------------+ | 16 | 1 | | 27 | 1 | | 6 | 1 | | 7 | 1 | | 23 | 1 | | 2 | 1 | | 14 | 1 | | 25 | 1 | | 28 | 2 | | 11 | 2 | | 24 | 2 | | 1 | 3 | | 17 | 4 | | 19 | 4 | | 8 | 5 | | 21 | 5 | | 22 | 5 | | 9 | 6 | | 12 | 6 | | 26 | 7 | | 10 | 7 | | 3 | 10 | | 15 | 13 | | 20 | 16 | | 18 | 19 | | 5 | 20 | | 13 | 25 | | 4 | 37 | +--------+---------------+ 28 rows in set (1.07 sec) Number of messages in each role: select role, count(role) from message group by (role); +------------+-------------+ | role | count(role) | +------------+-------------+ | helpful | 118 | | irrelevant | 54 | | new | 28 | | unhelpful | 6 | +------------+-------------+ Number of unresolved messages: select count(resolved) from thread where resolved=0; +-----------------+ | count(resolved) | +-----------------+ | 14 | +-----------------+ 1 row in set (0.00 sec) Number of unresolved messages: select count(resolved) from thread where resolved=1; +-----------------+ | count(resolved) | +-----------------+ | 14 | +-----------------+ 1 row in set (0.01 sec) Seconds required to resolve question, in order: select id, unix_timestamp(resolved_time)-unix_timestamp(start_time) as resolved_time from thread where resolved=1 order by resolved_time; There is one bad result (a negative number of seconds). It seems that the mail software got times out of sync or did something else to report incorrect times on the messages. If it's my mistake, I can't see where the mistake is. +----+---------------+ | id | resolved_time | +----+---------------+ | 26 | -712420 | REMOVE THIS | 4 | 482 | | 17 | 1131 | | 1 | 1734 | | 19 | 4351 | | 12 | 8751 | | 3 | 13527 | | 21 | 35138 | | 11 | 41664 | | 15 | 85616 | | 10 | 136027 | | 20 | 141075 | | 24 | 148493 | | 28 | 210552 | +----+---------------+ 14 rows in set (0.00 sec) Median is 35138 seconds time: 9:45:38 maximum is 58:29:12 minimum is 0:8:2 Number of messages on each thread, grouped by whether thread is resolved and ordered by number of messages: select message.thread, count(message.id) as num_messages, thread.resolved from message, thread where message.thread = thread.id group by message.thread order by thread.resolved, num_messages; +--------+--------------+----------+ | thread | num_messages | resolved | +--------+--------------+----------+ | 27 | 1 | 0 | | 14 | 1 | 0 | | 16 | 1 | 0 | | 2 | 1 | 0 | | 6 | 1 | 0 | | 7 | 1 | 0 | | 23 | 1 | 0 | | 25 | 1 | 0 | | 22 | 5 | 0 | | 8 | 5 | 0 | | 9 | 6 | 0 | | 18 | 19 | 0 | | 5 | 20 | 0 | | 13 | 25 | 0 | | 11 | 2 | 1 | | 28 | 2 | 1 | | 24 | 2 | 1 | | 1 | 3 | 1 | | 17 | 4 | 1 | | 19 | 4 | 1 | | 21 | 5 | 1 | | 12 | 6 | 1 | | 10 | 7 | 1 | | 26 | 7 | 1 | | 3 | 10 | 1 | | 15 | 13 | 1 | | 20 | 16 | 1 | | 4 | 37 | 1 | +--------+--------------+----------+ 28 rows in set (0.00 sec) median for unresolved: 1 median for resolved: 5