| Limit (cost=2623.48..2623.53 rows=20 width=375) |
| -> Sort (cost=2623.43..2629.05 rows=2246 width=375) |
| Sort Key: (CASE WHEN (t0.id IS NOT NULL) THEN t0.remind_date ELSE sc.signed_at END) DESC |
| -> Hash Left Join (cost=2442.83..2552.44 rows=2246 width=375) |
| Hash Cond: (sc.id = r.purchase_contract_id) |
| -> Hash Left Join (cost=806.61..837.31 rows=2246 width=143) |
| Hash Cond: (sc.id = ovsub.id) |
| -> Hash Left Join (cost=477.32..502.12 rows=2246 width=111) |
| Hash Cond: (sc.id = sci.contract_id) |
| -> Hash Right Join (cost=218.85..237.74 rows=2246 width=79) |
| 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=41) |
| Group Key: t0.id |
| -> Hash Join (cost=99.02..117.64 rows=835 width=32) |
| 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=32) |
| -> 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=51) |
| -> Seq Scan on tbl_purchase_contracts sc (cost=0.00..70.76 rows=2269 width=51) |
| Filter: ((NOT is_draft) AND (NOT is_refuse)) |
| -> Hash (cost=230.21..230.21 rows=2261 width=36) |
| -> Subquery Scan on sci (cost=179.33..230.21 rows=2261 width=36) |
| -> HashAggregate (cost=179.33..207.60 rows=2261 width=36) |
| Group Key: t0_1.id |
| -> Hash Right Join (cost=99.02..166.54 rows=2558 width=17) |
| Hash Cond: (t1_1.contract_id = t0_1.id) |
| -> Seq Scan on tbl_purchase_contract_invoices t1_1 (cost=0.00..60.75 rows=2575 width=10) |
| -> Hash (cost=70.76..70.76 rows=2261 width=11) |
| -> Seq Scan on tbl_purchase_contracts t0_1 (cost=0.00..70.76 rows=2261 width=11) |
| Filter: (NOT is_chargeback) |
| -> Hash (cost=326.74..326.74 rows=204 width=36) |
| -> Subquery Scan on ovsub (cost=322.15..326.74 rows=204 width=36) |
| -> HashAggregate (cost=322.15..324.70 rows=204 width=36) |
| Group Key: t1_2.id |
| -> Hash Join (cost=127.23..321.13 rows=204 width=10) |
| Hash Cond: (p.id = t1_2.from_project) |
| -> Seq Scan on tbl_projects p (cost=0.00..185.50 rows=1703 width=4) |
| Filter: (project_status = 3) |
| -> Hash (cost=122.50..122.50 rows=379 width=14) |
| -> Hash Join (cost=37.74..122.50 rows=379 width=14) |
| Hash Cond: (t1_2.id = t0_2.contract_id) |
| -> Seq Scan on tbl_sales_contracts t1_2 (cost=0.00..68.32 rows=1686 width=8) |
| Filter: (need_analysis AND (from_project IS NOT NULL)) |
| -> Hash (cost=32.88..32.88 rows=389 width=10) |
| -> Seq Scan on tbl_sales_contract_payment_collection_remind_dates t0_2 (cost=0.00..32.88 rows=389 width=10) |
| Filter: (((status = 1) AND (overdue_days IS NOT NULL)) OR ((status = 0) AND (remind_date <= '2026-06-30'::date))) |
| -> Hash (cost=1636.10..1636.10 rows=10 width=36) |
| -> GroupAggregate (cost=1635.80..1636.00 rows=10 width=36) |
| Group Key: r.purchase_contract_id |
| -> Sort (cost=1635.80..1635.82 rows=10 width=10) |
| Sort Key: r.purchase_contract_id |
| -> Nested Loop (cost=0.28..1635.63 rows=10 width=10) |
| -> Seq Scan on tbl_term_taxonomy_relationships dt1 (cost=0.00..1470.03 rows=32 width=4) |
| Filter: ((term_id = 17) AND (taxonomy_id = 2100000000)) |
| -> Index Scan using tbl_approves_pkey on tbl_approves r (cost=0.28..5.18 rows=1 width=14) |
| Index Cond: (id = dt1.object_id) |
| Filter: (status = 2) |