QUERY PLAN
Aggregate (cost=800.85..800.86 rows=1 width=64)
-> Hash Join (cost=558.87..800.75 rows=18 width=4)
Hash Cond: (cr.case_id = c.id)
-> Seq Scan on tbl_callback_records cr (cost=0.00..241.54 rows=132 width=8)
Filter: ((callback_date >= '2026-01-01'::date) AND (callback_date < '2027-01-01 00:00:00'::timestamp without time zone) AND ((satisfaction_score <> 0) OR (skill_score <> 0)))
-> Hash (cost=545.50..545.50 rows=1069 width=4)
-> Subquery Scan on c (cost=524.12..545.50 rows=1069 width=4)
-> HashAggregate (cost=524.12..534.81 rows=1069 width=285)
Group Key: c_1.id
-> Hash Right Join (cost=386.93..521.45 rows=1069 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=373.56..373.56 rows=1069 width=4)
-> Seq Scan on tbl_cases c_1 (cost=0.00..373.56 rows=1069 width=4)
Filter: ((case_type = 1) AND (case_status = 5) AND (last_engineer = ANY ('{5085,5248,1015,1022,5064,1023}'::integer[])))