QUERY PLAN
Aggregate (cost=628.11..628.12 rows=1 width=32)
-> Hash Join (cost=443.00..628.11 rows=1 width=8)
Hash Cond: (ca.case_id = c.id)
-> Seq Scan on tbl_case_assignments ca (cost=0.00..185.03 rows=30 width=12)
Filter: (engineer_id = 1001)
-> Hash (cost=441.29..441.29 rows=137 width=4)
-> Subquery Scan on c (cost=438.55..441.29 rows=137 width=4)
-> HashAggregate (cost=438.55..439.92 rows=137 width=285)
Group Key: c_1.id
-> Hash Right Join (cost=313.24..438.21 rows=137 width=4)
Hash Cond: (cs.case_id = c_1.id)
-> Seq Scan on tbl_case_services cs (cost=0.00..106.88 rows=6888 width=4)
-> Hash (cost=311.52..311.52 rows=137 width=4)
-> Seq Scan on tbl_cases c_1 (cost=0.00..311.52 rows=137 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))