QUERY PLAN
Sort (cost=48.86..48.86 rows=1 width=38)
Sort Key: collected_date, created_at
-> Seq Scan on tbl_sales_contract_payments (cost=0.00..48.85 rows=1 width=38)
Filter: ((amount > '0'::numeric) AND (amount > paid_amount) AND (contract_id = 3830))