| Limit (cost=1413.50..1413.55 rows=20 width=604) |
| -> Sort (cost=1413.50..1415.09 rows=636 width=604) |
| Sort Key: (sum(pc.total_amount)) DESC NULLS LAST |
| -> HashAggregate (cost=1372.72..1396.57 rows=636 width=604) |
| Group Key: s.id |
| -> Hash Left Join (cost=1322.42..1356.82 rows=636 width=492) |
| Hash Cond: (s.id = pcr2.supplier_id) |
| -> Hash Left Join (cost=1054.93..1087.65 rows=636 width=484) |
| Hash Cond: (s.id = pcr.supplier_id) |
| -> Hash Left Join (cost=787.43..818.47 rows=636 width=476) |
| Hash Cond: (s.id = pc.supplier_id) |
| -> Seq Scan on tbl_suppliers s (cost=0.00..29.36 rows=636 width=380) |
| -> Hash (cost=781.90..781.90 rows=443 width=100) |
| -> Subquery Scan on pc (cost=769.71..781.90 rows=443 width=100) |
| -> HashAggregate (cost=769.71..777.47 rows=443 width=100) |
| Group Key: pc_1.supplier_id |
| -> Hash Left Join (cost=672.08..748.48 rows=2123 width=74) |
| Hash Cond: (pc_1.id = pci.contract_id) |
| -> Hash Left Join (cost=534.28..605.10 rows=2123 width=46) |
| Hash Cond: (pc_1.id = pcp.contract_id) |
| -> Seq Scan on tbl_purchase_contracts pc_1 (cost=0.00..65.23 rows=2123 width=14) |
| -> Hash (cost=531.78..531.78 rows=200 width=36) |
| -> Subquery Scan on pcp (cost=527.28..531.78 rows=200 width=36) |
| -> HashAggregate (cost=527.28..529.78 rows=200 width=36) |
| Group Key: "*SELECT* 1".contract_id |
| -> Append (cost=94.76..505.21 rows=4415 width=22) |
| -> Subquery Scan on "*SELECT* 1" (cost=94.76..162.57 rows=2313 width=10) |
| -> Hash Join (cost=94.76..139.44 rows=2313 width=98) |
| Hash Cond: (r.erp_payment_ticket_id = t.id) |
| -> Seq Scan on tbl_erp_payment_ticket_settles r (cost=0.00..38.50 rows=2350 width=14) |
| -> Hash (cost=67.60..67.60 rows=2173 width=4) |
| -> Seq Scan on tbl_erp_payment_tickets t (cost=0.00..67.60 rows=2173 width=4) |
| Filter: (is_payment_settle AND (status = ANY ('{2,5}'::integer[]))) |
| -> Subquery Scan on "*SELECT* 2" (cost=1.07..2.33 rows=1 width=36) |
| -> Hash Join (cost=1.07..2.32 rows=1 width=124) |
| Hash Cond: (t_1.id = r_1.erp_other_income_ticket_id) |
| -> Seq Scan on tbl_erp_other_income_tickets t_1 (cost=0.00..1.24 rows=2 width=4) |
| Filter: (status = ANY ('{2,5}'::integer[])) |
| -> Hash (cost=1.03..1.03 rows=3 width=40) |
| -> Seq Scan on tbl_erp_other_income_ticket_purchase_contract_settles r_1 (cost=0.00..1.03 rows=3 width=40) |
| -> Subquery Scan on "*SELECT* 3" (cost=0.28..185.71 rows=27 width=36) |
| -> Nested Loop (cost=0.28..185.44 rows=27 width=124) |
| -> Seq Scan on tbl_erp_cash_cost_ticket_purchase_contract_settles r_2 (cost=0.00..1.27 rows=27 width=40) |
| -> Index Scan using tbl_erp_cash_cost_tickets_pkey on tbl_erp_cash_cost_tickets t_2 (cost=0.28..6.82 rows=1 width=4) |
| Index Cond: (id = r_2.erp_cash_cost_ticket_id) |
| Filter: (is_payment_settle AND (status = ANY ('{2,5}'::integer[]))) |
| -> Subquery Scan on "*SELECT* 4" (cost=88.44..154.60 rows=2074 width=36) |
| -> Hash Join (cost=88.44..133.86 rows=2074 width=124) |
| Hash Cond: (r_3.erp_collect_ticket_id = t_3.id) |
| -> Seq Scan on tbl_erp_collect_ticket_settles r_3 (cost=0.00..34.77 rows=2077 width=14) |
| -> Hash (cost=61.74..61.74 rows=2136 width=4) |
| -> Seq Scan on tbl_erp_collect_tickets t_3 (cost=0.00..61.74 rows=2136 width=4) |
| Filter: (status = ANY ('{2,5}'::integer[])) |
| -> Hash (cost=112.32..112.32 rows=2038 width=36) |
| -> Subquery Scan on pci (cost=66.47..112.32 rows=2038 width=36) |
| -> HashAggregate (cost=66.47..91.94 rows=2038 width=36) |
| Group Key: tbl_purchase_contract_invoices.contract_id |
| -> Seq Scan on tbl_purchase_contract_invoices (cost=0.00..54.65 rows=2364 width=10) |
| Filter: ((red_invoice_id IS NOT NULL) OR (NOT is_cancel)) |
| -> Hash (cost=261.96..261.96 rows=443 width=12) |
| -> Subquery Scan on pcr (cost=238.06..261.96 rows=443 width=12) |
| -> GroupAggregate (cost=238.06..257.53 rows=443 width=12) |
| Group Key: pc_2.supplier_id |
| -> Sort (cost=238.06..243.07 rows=2005 width=8) |
| Sort Key: pc_2.supplier_id |
| -> Hash Left Join (cost=91.77..128.09 rows=2005 width=8) |
| Hash Cond: (pcr_1.contract_id = pc_2.id) |
| -> Seq Scan on tbl_purchase_client_rels pcr_1 (cost=0.00..31.05 rows=2005 width=8) |
| -> Hash (cost=65.23..65.23 rows=2123 width=8) |
| -> Seq Scan on tbl_purchase_contracts pc_2 (cost=0.00..65.23 rows=2123 width=8) |
| -> Hash (cost=261.96..261.96 rows=443 width=12) |
| -> Subquery Scan on pcr2 (cost=238.06..261.96 rows=443 width=12) |
| -> GroupAggregate (cost=238.06..257.53 rows=443 width=12) |
| Group Key: pc_3.supplier_id |
| -> Sort (cost=238.06..243.07 rows=2005 width=8) |
| Sort Key: pc_3.supplier_id |
| -> Hash Left Join (cost=91.77..128.09 rows=2005 width=8) |
| Hash Cond: (pcr_2.contract_id = pc_3.id) |
| -> Seq Scan on tbl_purchase_client_rels pcr_2 (cost=0.00..31.05 rows=2005 width=8) |
| -> Hash (cost=65.23..65.23 rows=2123 width=8) |
| -> Seq Scan on tbl_purchase_contracts pc_3 (cost=0.00..65.23 rows=2123 width=8) |