Aggregate (cost=990.02..990.03 rows=1 width=32) |
-> Hash Left Join (cost=939.47..989.99 rows=10 width=6) |
Hash Cond: (sc.id = spc_1.id) |
Filter: (((scpcrd.remind_date >= '2025-08-01'::date) AND (scpcrd.remind_date <= '2025-08-31'::date)) OR ((CASE WHEN (spc_1.erp_settle_amount IS NULL) THEN '0'::numeric ELSE spc_1.erp_settle_amount END < (SubPlan 1)) AND (CASE WHEN (scpcrd.remind_date <= '2025-08-09'::date) THEN ((SubPlan 2) - CASE WHEN (spc_1.erp_settle_amount IS NULL) THEN '0'::numeric ELSE spc_1.erp_settle_amount END) ELSE '0'::numeric END > '0'::numeric))) |
-> Nested Loop Left Join (cost=663.16..713.48 rows=76 width=18) |
-> Hash Join (cost=662.88..675.11 rows=76 width=14) |
Hash Cond: (scpcrd.id = scpcrd_1.id) |
-> Seq Scan on tbl_purchase_contract_payment_collection_remind_dates scpcrd (cost=0.00..10.72 rows=572 width=18) |
-> Hash (cost=661.93..661.93 rows=76 width=4) |
-> Group (cost=660.79..661.17 rows=76 width=4) |
Group Key: scpcrd_1.id |
-> Sort (cost=660.79..660.98 rows=76 width=4) |
Sort Key: scpcrd_1.id |
-> Nested Loop (cost=507.75..658.41 rows=76 width=4) |
-> Hash Left Join (cost=507.47..521.20 rows=76 width=8) |
Hash Cond: (sc_2.id = spc.id) |
Filter: (((scpcrd_1.remind_date >= '2025-08-01'::date) AND (scpcrd_1.remind_date <= '2025-08-31'::date)) OR ((CASE WHEN (spc.erp_settle_amount IS NULL) THEN '0'::numeric ELSE spc.erp_settle_amount END < (SubPlan 3)) AND (CASE WHEN (scpcrd_1.remind_date <= '2025-08-09'::date) THEN ((SubPlan 4) - CASE WHEN (spc.erp_settle_amount IS NULL) THEN '0'::numeric ELSE spc.erp_settle_amount END) ELSE '0'::numeric END > '0'::numeric))) |
-> Hash Left Join (cost=231.16..243.38 rows=572 width=16) |
Hash Cond: (scpcrd_1.contract_id = sc_2.id) |
-> Seq Scan on tbl_purchase_contract_payment_collection_remind_dates scpcrd_1 (cost=0.00..10.72 rows=572 width=12) |
-> Hash (cost=206.07..206.07 rows=2007 width=8) |
-> Seq Scan on tbl_purchase_contracts sc_2 (cost=0.00..206.07 rows=2007 width=8) |
-> Hash (cost=251.23..251.23 rows=2007 width=10) |
-> HashAggregate (cost=211.09..231.16 rows=2007 width=10) |
Group Key: spc.id |
-> Seq Scan on tbl_purchase_contracts spc (cost=0.00..206.07 rows=2007 width=10) |
SubPlan 3 |
-> Aggregate (cost=13.58..13.59 rows=1 width=32) |
-> Seq Scan on tbl_purchase_contract_payment_collection_remind_dates scpcrdsub_2 (cost=0.00..13.58 rows=1 width=6) |
Filter: ((remind_date <= scpcrd_1.remind_date) AND (contract_id = scpcrd_1.contract_id)) |
SubPlan 4 |
-> Aggregate (cost=13.58..13.59 rows=1 width=32) |
-> Seq Scan on tbl_purchase_contract_payment_collection_remind_dates scpcrdsub_3 (cost=0.00..13.58 rows=1 width=6) |
Filter: ((remind_date <= scpcrd_1.remind_date) AND (contract_id = scpcrd_1.contract_id)) |
-> Index Scan using tbl_purchase_contracts_pkey on tbl_purchase_contracts sc_1 (cost=0.28..1.81 rows=1 width=4) |
Index Cond: (id = scpcrd_1.contract_id) |
Filter: ((NOT is_draft) AND (NOT is_refuse)) |
-> Index Only Scan using tbl_purchase_contracts_pkey on tbl_purchase_contracts sc (cost=0.28..0.50 rows=1 width=4) |
Index Cond: (id = scpcrd.contract_id) |
-> Hash (cost=251.23..251.23 rows=2007 width=10) |
-> HashAggregate (cost=211.09..231.16 rows=2007 width=10) |
Group Key: spc_1.id |
-> Seq Scan on tbl_purchase_contracts spc_1 (cost=0.00..206.07 rows=2007 width=10) |
SubPlan 1 |
-> Aggregate (cost=13.58..13.59 rows=1 width=32) |
-> Seq Scan on tbl_purchase_contract_payment_collection_remind_dates scpcrdsub (cost=0.00..13.58 rows=1 width=6) |
Filter: ((remind_date <= scpcrd.remind_date) AND (contract_id = scpcrd.contract_id)) |
SubPlan 2 |
-> Aggregate (cost=13.58..13.59 rows=1 width=32) |
-> Seq Scan on tbl_purchase_contract_payment_collection_remind_dates scpcrdsub_1 (cost=0.00..13.58 rows=1 width=6) |
Filter: ((remind_date <= scpcrd.remind_date) AND (contract_id = scpcrd.contract_id)) |