QUERY PLAN
Aggregate (cost=63.52..63.53 rows=1 width=8)
-> Sort (cost=62.63..62.78 rows=59 width=228)
Sort Key: s.created_at
-> HashAggregate (cost=60.30..60.89 rows=59 width=228)
Group Key: s.id, u.id
-> Hash Left Join (cost=12.11..60.01 rows=59 width=16)
Hash Cond: (s.head_of = u.id)
-> Seq Scan on tbl_tasks s (cost=0.00..47.75 rows=59 width=24)
Filter: ((parent_id IS NULL) AND (task_group_id = 106))
-> Hash (cost=10.30..10.30 rows=144 width=4)
-> Index Only Scan using tbl_users_pkey on tbl_users u (cost=0.14..10.30 rows=144 width=4)