QUERY PLAN
Limit (cost=65.34..65.36 rows=7 width=198)
-> Sort (cost=65.34..65.36 rows=7 width=198)
Sort Key: s.target_completed_at, s.updated_at DESC
-> Group (cost=65.19..65.24 rows=7 width=198)
Group Key: s.id, u.id
-> Sort (cost=65.19..65.20 rows=7 width=198)
Sort Key: s.id, u.id
-> Hash Join (cost=17.07..65.09 rows=7 width=198)
Hash Cond: (s.head_of = u.id)
-> Seq Scan on tbl_tasks s (cost=0.00..47.89 rows=48 width=194)
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)