QUERY PLAN
Aggregate (cost=6.36..6.37 rows=1 width=32)
-> Nested Loop (cost=1.07..6.35 rows=1 width=32)
Join Filter: (r.erp_other_income_ticket_id = t.id)
-> Seq Scan on tbl_erp_other_income_tickets t (cost=0.00..1.28 rows=1 width=4)
Filter: ((bank_settle_at <= '2025-12-31 23:59:59+08'::timestamp with time zone) AND (status = 2))
-> Hash Join (cost=1.07..5.03 rows=3 width=36)
Hash Cond: (op.id = r.erp_other_payment_ticket_id)
-> Seq Scan on tbl_erp_other_payment_tickets op (cost=0.00..3.74 rows=51 width=4)
Filter: (ticket_type = ANY ('{1,2,4}'::integer[]))
-> Hash (cost=1.03..1.03 rows=3 width=40)
-> Seq Scan on tbl_erp_other_income_ticket_purchase_contract_settles r (cost=0.00..1.03 rows=3 width=40)
Filter: (erp_other_payment_ticket_id IS NOT NULL)