QUERY PLAN
Limit (cost=50.71..50.76 rows=20 width=149)
-> Sort (cost=50.71..50.76 rows=20 width=149)
Sort Key: s.target_completed_at, s.created_at DESC
-> Group (cost=50.13..50.28 rows=20 width=149)
Group Key: s.id, u.id
-> Sort (cost=50.13..50.18 rows=20 width=149)
Sort Key: s.id, u.id
-> Hash Left Join (cost=9.17..49.70 rows=20 width=149)
Hash Cond: (s.head_of = u.id)
-> Seq Scan on tbl_tasks s (cost=0.00..40.48 rows=20 width=145)
Filter: (status = 0)
-> Hash (cost=7.41..7.41 rows=141 width=4)
-> Seq Scan on tbl_users u (cost=0.00..7.41 rows=141 width=4)