QUERY PLAN
Aggregate (cost=207.19..207.20 rows=1 width=32)
-> Hash Join (cost=130.36..201.90 rows=2115 width=6)
Hash Cond: (t.purchase_contract_id = t_1.id)
-> Seq Scan on tbl_erp_payment_tickets t (cost=0.00..65.94 rows=2129 width=10)
Filter: (is_payment_settle AND (created_at < '2025-08-20 17:41:03+08'::timestamp with time zone) AND (status = 2))
-> Hash (cost=105.26..105.26 rows=2008 width=4)
-> Seq Scan on tbl_purchase_contracts t_1 (cost=0.00..105.26 rows=2008 width=4)
Filter: ((NOT is_draft) AND (NOT is_refuse) AND (NOT is_chargeback) AND (created_at < '2025-08-20 17:41:03+08'::timestamp with time zone))