QUERY PLAN
Aggregate (cost=87.43..87.44 rows=1 width=8)
-> Append (cost=0.00..87.42 rows=3 width=0)
-> Subquery Scan on "*SELECT* 2" (cost=0.00..81.32 rows=1 width=0)
-> Seq Scan on tbl_sales_contracts (cost=0.00..81.31 rows=1 width=434)
Filter: ((client_id = 2133) AND ((amount - erp_all_settle_amount) > '0'::numeric))
-> Subquery Scan on "*SELECT* 3" (cost=0.00..3.19 rows=1 width=0)
-> Seq Scan on tbl_erp_cost_tickets (cost=0.00..3.18 rows=1 width=242)
Filter: ((status = 2) AND (client_id = 2133) AND ((amount - all_settle_amount) > '0'::numeric))
-> Subquery Scan on "*SELECT* 4" (cost=0.00..2.91 rows=1 width=0)
-> Seq Scan on tbl_erp_other_payment_tickets (cost=0.00..2.90 rows=1 width=242)
Filter: ((status = 2) AND (client_id = 2133) AND ((amount - all_settle_amount) > '0'::numeric))