QUERY PLAN
Aggregate (cost=455.21..455.22 rows=1 width=16)
-> Append (cost=0.28..455.20 rows=2 width=16)
-> Nested Loop (cost=0.28..353.15 rows=1 width=16)
-> Seq Scan on tbl_implement_records ir (cost=0.00..344.78 rows=1 width=20)
Filter: ((NOT is_draft) AND (arrived_at >= '2025-08-21 00:00:00+08'::timestamp with time zone) AND (arrived_at <= '2025-08-21 23:59:59+08'::timestamp with time zone))
-> Index Scan using tbl_cases_pkey on tbl_cases c (cost=0.28..8.30 rows=1 width=4)
Index Cond: (id = ir.case_id)
Filter: (deduct_points_from = 1001)
-> Nested Loop (cost=0.28..102.03 rows=1 width=16)
-> Seq Scan on tbl_pre_sales ps (cost=0.00..93.67 rows=1 width=20)
Filter: ((NOT is_draft) AND (start_at >= '2025-08-21 00:00:00+08'::timestamp with time zone) AND (start_at <= '2025-08-21 23:59:59+08'::timestamp with time zone))
-> Index Scan using tbl_cases_pkey on tbl_cases c_1 (cost=0.28..8.30 rows=1 width=4)
Index Cond: (id = ps.case_id)
Filter: (deduct_points_from = 1001)