QUERY PLAN
Aggregate (cost=620.44..620.45 rows=1 width=32)
-> Hash Join (cost=437.67..620.43 rows=1 width=8)
Hash Cond: (ca.case_id = c.id)
-> Seq Scan on tbl_case_assignments ca (cost=0.00..182.70 rows=23 width=12)
Filter: (engineer_id = 1001)
-> Hash (cost=436.24..436.24 rows=115 width=4)
-> Subquery Scan on c (cost=434.51..436.24 rows=115 width=4)
-> Group (cost=434.51..435.09 rows=115 width=285)
Group Key: c_1.id
-> Sort (cost=434.51..434.80 rows=115 width=4)
Sort Key: c_1.id
-> Hash Right Join (cost=308.14..430.57 rows=115 width=4)
Hash Cond: (cs.case_id = c_1.id)
-> Seq Scan on tbl_case_services cs (cost=0.00..104.66 rows=6766 width=4)
-> Hash (cost=306.71..306.71 rows=115 width=4)
-> Seq Scan on tbl_cases c_1 (cost=0.00..306.71 rows=115 width=4)
Filter: ((closed_at >= '2025-01-01 00:00:00+08'::timestamp with time zone) AND (closed_at <= '2025-12-31 23:59:59+08'::timestamp with time zone) AND (case_type = 1))