QUERY PLAN
Limit (cost=157.96..157.96 rows=2 width=252)
-> Sort (cost=157.96..157.96 rows=2 width=252)
Sort Key: s.target_completed_at DESC, s.updated_at DESC
-> Group (cost=157.94..157.95 rows=2 width=252)
Group Key: s.id, u.id
-> Sort (cost=157.94..157.94 rows=2 width=252)
Sort Key: s.id
-> Nested Loop (cost=0.00..157.93 rows=2 width=252)
-> Seq Scan on tbl_users u (cost=0.00..8.12 rows=1 width=4)
Filter: ((id = 5064) AND (department_id = 10))
-> Seq Scan on tbl_tasks s (cost=0.00..149.79 rows=2 width=248)
Filter: ((parent_id IS NULL) AND (head_of = 5064) AND (status = '0'::smallint))