QUERY PLAN
Aggregate (cost=383.74..383.75 rows=1 width=8)
-> Nested Loop (cost=0.29..383.74 rows=1 width=4)
-> Seq Scan on tbl_implement_records ir (cost=0.00..375.42 rows=1 width=8)
Filter: ((NOT is_draft) AND (arrived_at >= '2026-06-03 00:00:00+08'::timestamp with time zone) AND (arrived_at <= '2026-06-03 23:59:59+08'::timestamp with time zone))
-> Index Scan using tbl_cases_pkey on tbl_cases c (cost=0.29..8.32 rows=1 width=4)
Index Cond: (id = ir.case_id)
Filter: (deduct_points_from = ANY ('{5332,1001,5087,5300,5311,5295,1013,5476,1004,1005}'::integer[]))