QUERY PLAN
Aggregate (cost=8.54..8.55 rows=1 width=8)
-> Append (cost=0.00..8.54 rows=2 width=0)
-> Subquery Scan on "*SELECT* 1" (cost=0.00..3.89 rows=1 width=0)
-> Seq Scan on tbl_erp_other_payment_tickets (cost=0.00..3.88 rows=1 width=198)
Filter: ((status = 2) AND (client_id = 2150) AND ((amount - all_settle_amount) > '0'::numeric))
-> Subquery Scan on "*SELECT* 2" (cost=0.00..4.65 rows=1 width=0)
-> Seq Scan on tbl_erp_cost_tickets (cost=0.00..4.64 rows=1 width=198)
Filter: ((status = 2) AND (client_id = 2150) AND ((amount - all_settle_amount) > '0'::numeric))