QUERY PLAN
Aggregate (cost=2.95..2.96 rows=1 width=8)
-> Append (cost=0.00..2.95 rows=1 width=0)
-> Subquery Scan on "*SELECT* 2" (cost=0.00..2.95 rows=1 width=0)
-> Seq Scan on tbl_erp_other_collect_tickets (cost=0.00..2.94 rows=1 width=238)
Filter: ((status = 2) AND (client_id = 89) AND ((amount - all_settle_amount) > '0'::numeric))