QUERY PLAN
Aggregate (cost=2.10..2.11 rows=1 width=32)
-> Nested Loop (cost=0.00..2.10 rows=1 width=32)
Join Filter: (r.erp_other_income_ticket_id = t.id)
-> Seq Scan on tbl_erp_other_income_ticket_purchase_contract_settles r (cost=0.00..1.01 rows=1 width=36)
Filter: (purchase_contract_id = 4141)
-> Seq Scan on tbl_erp_other_income_tickets t (cost=0.00..1.06 rows=2 width=4)
Filter: (status = ANY ('{2,5}'::integer[]))