QUERY PLAN
Aggregate (cost=803.92..803.93 rows=1 width=64)
-> Hash Join (cost=567.95..803.20 rows=142 width=4)
Hash Cond: (cr.case_id = c.id)
-> Seq Scan on tbl_callback_records cr (cost=0.00..232.98 rows=865 width=8)
Filter: ((callback_date >= '2025-01-01'::date) AND (callback_date < '2026-01-01 00:00:00'::timestamp without time zone) AND ((satisfaction_score <> 0) OR (skill_score <> 0)))
-> Hash (cost=552.59..552.59 rows=1229 width=4)
-> Subquery Scan on c (cost=528.01..552.59 rows=1229 width=4)
-> HashAggregate (cost=528.01..540.30 rows=1229 width=285)
Group Key: c_1.id
-> Hash Right Join (cost=396.14..524.94 rows=1229 width=4)
Hash Cond: (cs.case_id = c_1.id)
-> Seq Scan on tbl_case_services cs (cost=0.00..110.12 rows=7112 width=4)
-> Hash (cost=380.77..380.77 rows=1229 width=4)
-> Seq Scan on tbl_cases c_1 (cost=0.00..380.77 rows=1229 width=4)
Filter: ((case_type = 1) AND (case_status = 5) AND (last_engineer = ANY ('{1017,5085,1001,5248,1015,1022,5296,1023}'::integer[])))