QUERY PLAN
Limit (cost=64.84..64.85 rows=3 width=194)
-> Sort (cost=64.84..64.85 rows=3 width=194)
Sort Key: s.target_completed_at, s.updated_at DESC
-> Group (cost=64.80..64.82 rows=3 width=194)
Group Key: s.id, u.id
-> Sort (cost=64.80..64.80 rows=3 width=194)
Sort Key: s.id, u.id
-> Hash Join (cost=16.91..64.77 rows=3 width=194)
Hash Cond: (s.head_of = u.id)
-> Seq Scan on tbl_tasks s (cost=0.00..47.75 rows=42 width=190)
Filter: ((parent_id IS NULL) AND (status = '0'::smallint))
-> Hash (cost=16.80..16.80 rows=9 width=4)
-> Seq Scan on tbl_users u (cost=0.00..16.80 rows=9 width=4)
Filter: (department_id = 9)