GROUP BY thread_id, IF(t.name = 'thread/sql/one_connection', CONCAT(t.processlist_user, '@', t.processlist_host), REPLACE(t.name, 'thread/', '')) ORDER BY SUM(current_number_of_bytes_used) DESC;