QUERY PLAN
Aggregate (cost=152.79..152.80 rows=1 width=8)
-> Sort (cost=135.25..138.18 rows=1169 width=228)
Sort Key: s.status, s.target_completed_at, s.updated_at DESC
-> HashAggregate (cost=64.00..75.69 rows=1169 width=228)
Group Key: s.id, u.id
-> Hash Left Join (cost=12.11..58.15 rows=1169 width=26)
Hash Cond: (s.head_of = u.id)
-> Seq Scan on tbl_tasks s (cost=0.00..42.89 rows=1169 width=34)
Filter: (parent_id IS NULL)
-> 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)