QUERY PLAN
Aggregate (cost=526.99..527.00 rows=1 width=8)
-> Hash Join (cost=96.28..526.83 rows=64 width=4)
Hash Cond: (c.id = ps.case_id)
-> Seq Scan on tbl_cases c (cost=0.00..391.06 rows=5180 width=4)
Filter: (deduct_points_from = ANY ('{5329,5332,5448,5420,1001,5087,5300,5311,5295,1013,1004,1005,5449}'::integer[]))
-> Hash (cost=95.00..95.00 rows=102 width=8)
-> Seq Scan on tbl_pre_sales ps (cost=0.00..95.00 rows=102 width=8)
Filter: ((NOT is_draft) AND (start_at >= '2025-01-01 00:00:00+08'::timestamp with time zone) AND (start_at <= '2025-12-31 23:59:59+08'::timestamp with time zone))