QUERY PLAN
Aggregate (cost=721.19..721.20 rows=1 width=32)
-> Hash Join (cost=467.31..721.14 rows=19 width=8)
Hash Cond: (ca.case_id = c.id)
-> Seq Scan on tbl_case_assignments ca (cost=0.00..238.98 rows=5655 width=12)
Filter: (engineer_id = ANY ('{5085,5248,1015,1022,5064,1023}'::integer[]))
-> Hash (cost=466.96..466.96 rows=28 width=4)
-> Subquery Scan on c (cost=466.54..466.96 rows=28 width=4)
-> Group (cost=466.54..466.68 rows=28 width=285)
Group Key: c_1.id
-> Sort (cost=466.54..466.61 rows=28 width=4)
Sort Key: c_1.id
-> Hash Right Join (cost=331.35..465.87 rows=28 width=4)
Hash Cond: (cs.case_id = c_1.id)
-> Seq Scan on tbl_case_services cs (cost=0.00..115.07 rows=7407 width=4)
-> Hash (cost=331.00..331.00 rows=28 width=4)
-> Seq Scan on tbl_cases c_1 (cost=0.00..331.00 rows=28 width=4)
Filter: ((closed_at >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (closed_at <= '2026-12-31 23:59:59+08'::timestamp with time zone) AND (case_type = 1))