QUERY PLAN
Aggregate (cost=37.50..37.51 rows=1 width=32)
-> Hash Right Join (cost=14.56..37.48 rows=4 width=8)
Hash Cond: (ca.case_id = c.id)
-> Seq Scan on tbl_case_assignments ca (cost=0.00..20.20 rows=1020 width=12)
-> Hash (cost=14.55..14.55 rows=1 width=4)
-> Seq Scan on tbl_cases c (cost=0.00..14.55 rows=1 width=4)
Filter: ((deduct_points_from = ANY ('{5493,5493}'::integer[])) AND (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))