QUERY PLAN
Aggregate (cost=735.74..735.75 rows=1 width=64)
-> Hash Join (cost=709.45..735.73 rows=1 width=4)
Hash Cond: (c.id = cr.case_id)
-> HashAggregate (cost=485.36..496.42 rows=1106 width=285)
Group Key: c.id
-> Hash Right Join (cost=360.16..482.59 rows=1106 width=4)
Hash Cond: (cs.case_id = c.id)
-> Seq Scan on tbl_case_services cs (cost=0.00..104.66 rows=6766 width=4)
-> Hash (cost=346.33..346.33 rows=1106 width=4)
-> Seq Scan on tbl_cases c (cost=0.00..346.33 rows=1106 width=4)
Filter: ((case_type = 1) AND (case_status = 5) AND (last_engineer = ANY ('{1017,5085,5248,1015,1022,1023}'::integer[])))
-> Hash (cost=224.08..224.08 rows=1 width=8)
-> Seq Scan on tbl_callback_records cr (cost=0.00..224.08 rows=1 width=8)
Filter: ((callback_date >= '2025-08-01'::date) AND (callback_date < '2025-09-01 00:00:00'::timestamp without time zone) AND ((satisfaction_score <> 0) OR (skill_score <> 0)))