| Aggregate (cost=1490.76..1490.77 rows=1 width=32) |
| -> Nested Loop (cost=419.21..1490.75 rows=3 width=6) |
| -> Hash Semi Join (cost=418.92..599.07 rows=661 width=10) |
| Hash Cond: (r.purchase_contract_id = s.id2) |
| -> Seq Scan on tbl_approves r (cost=0.00..165.86 rows=2642 width=14) |
| Filter: (status = 2) |
| -> Hash (cost=390.84..390.84 rows=2246 width=4) |
| -> Subquery Scan on s (cost=362.77..390.84 rows=2246 width=4) |
| -> Sort (cost=362.77..368.38 rows=2246 width=663) |
| Sort Key: (CASE WHEN (t0.id IS NOT NULL) THEN t0.remind_date ELSE sc.signed_at END) DESC |
| -> Hash Right Join (cost=218.85..237.74 rows=2246 width=663) |
| Hash Cond: (t0.contract_id = sc.id) |
| Filter: (((t0.id IS NOT NULL) AND (t0.paid_amount <> '0'::numeric)) OR ((t0.id IS NULL) AND (sc.erp_settle_amount > '0'::numeric))) |
| -> HashAggregate (cost=119.73..128.08 rows=835 width=67) |
| Group Key: t0.id |
| -> Hash Join (cost=99.02..117.64 rows=835 width=18) |
| Hash Cond: (t0.contract_id = t1.id) |
| -> Seq Scan on tbl_purchase_contract_payment_collection_remind_dates t0 (cost=0.00..16.41 rows=841 width=18) |
| -> Hash (cost=70.76..70.76 rows=2261 width=4) |
| -> Seq Scan on tbl_purchase_contracts t1 (cost=0.00..70.76 rows=2261 width=4) |
| Filter: (NOT is_chargeback) |
| -> Hash (cost=70.76..70.76 rows=2269 width=18) |
| -> Seq Scan on tbl_purchase_contracts sc (cost=0.00..70.76 rows=2269 width=18) |
| Filter: ((NOT is_draft) AND (NOT is_refuse)) |
| -> Index Scan using tbl_term_taxonomy_relationships_object_id_term_id_idx on tbl_term_taxonomy_relationships dt1 (cost=0.29..1.34 rows=1 width=4) |
| Index Cond: ((object_id = r.id) AND (term_id = 17)) |
| Filter: (taxonomy_id = 2100000000) |