QUERY PLAN
Aggregate (cost=116.02..116.03 rows=1 width=8)
-> Sort (cost=102.47..104.73 rows=903 width=160)
Sort Key: s.status, s.target_completed_at DESC, s.updated_at DESC
-> HashAggregate (cost=49.11..58.14 rows=903 width=160)
Group Key: s.id, u.id
-> Hash Left Join (cost=9.13..44.59 rows=903 width=26)
Hash Cond: (s.head_of = u.id)
-> Seq Scan on tbl_tasks s (cost=0.00..33.03 rows=903 width=34)
-> Hash (cost=7.39..7.39 rows=139 width=4)
-> Seq Scan on tbl_users u (cost=0.00..7.39 rows=139 width=4)