QUERY PLAN
Limit (cost=63.18..63.19 rows=5 width=204)
-> Sort (cost=63.18..63.19 rows=5 width=204)
Sort Key: s.target_completed_at, s.updated_at DESC
-> Group (cost=63.08..63.12 rows=5 width=204)
Group Key: s.id, u.id
-> Sort (cost=63.08..63.10 rows=5 width=204)
Sort Key: s.id, u.id
-> Hash Join (cost=17.07..63.03 rows=5 width=204)
Hash Cond: (s.head_of = u.id)
-> Seq Scan on tbl_tasks s (cost=0.00..45.86 rows=34 width=200)
Filter: ((parent_id IS NULL) AND (status = '0'::smallint))
-> Hash (cost=16.80..16.80 rows=22 width=4)
-> Seq Scan on tbl_users u (cost=0.00..16.80 rows=22 width=4)
Filter: (department_id = 10)