QUERY PLAN
Aggregate (cost=7.92..7.93 rows=1 width=32)
-> Hash Join (cost=4.07..7.90 rows=7 width=32)
Hash Cond: (op.id = r.erp_other_payment_ticket_id)
-> Seq Scan on tbl_erp_other_payment_tickets op (cost=0.00..3.60 rows=42 width=4)
Filter: (ticket_type = ANY ('{1,2,4}'::integer[]))
-> Hash (cost=3.98..3.98 rows=7 width=36)
-> Hash Join (cost=1.18..3.98 rows=7 width=36)
Hash Cond: (t.id = r.erp_other_income_ticket_id)
-> Seq Scan on tbl_erp_other_income_tickets t (cost=0.00..2.60 rows=35 width=4)
Filter: ((bank_settle_at <= '2026-06-30 23:59:59+08'::timestamp with time zone) AND (status = 2))
-> Hash (cost=1.08..1.08 rows=8 width=40)
-> Seq Scan on tbl_erp_other_income_ticket_purchase_contract_settles r (cost=0.00..1.08 rows=8 width=40)
Filter: (erp_other_payment_ticket_id IS NOT NULL)