| GroupAggregate (cost=443.89..36802.16 rows=1 width=604) |
| Group Key: s.id |
| -> Hash Left Join (cost=443.89..729.70 rows=1442897 width=492) |
| Hash Cond: (s.id = pcr2.supplier_id) |
| -> Nested Loop Left Join (cost=331.16..441.41 rows=12769 width=484) |
| Join Filter: (pcr.supplier_id = s.id) |
| -> Nested Loop Left Join (cost=259.04..326.18 rows=113 width=476) |
| Join Filter: (pc.supplier_id = s.id) |
| -> Index Scan using tbl_suppliers_pkey on tbl_suppliers s (cost=0.28..8.29 rows=1 width=380) |
| Index Cond: (id = 46) |
| -> GroupAggregate (cost=258.76..316.73 rows=113 width=100) |
| Group Key: pc.supplier_id |
| -> Hash Right Join (cost=258.76..313.48 rows=127 width=48) |
| Hash Cond: (tbl_purchase_contract_invoices.contract_id = pc.id) |
| -> 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=190.71..190.71 rows=127 width=20) |
| -> Hash Right Join (cost=142.66..190.71 rows=127 width=20) |
| Hash Cond: (tbl_purchase_contracts.id = pc.id) |
| -> HashAggregate (cost=70.54..91.77 rows=2123 width=10) |
| Group Key: tbl_purchase_contracts.id |
| -> Seq Scan on tbl_purchase_contracts (cost=0.00..65.23 rows=2123 width=10) |
| -> Hash (cost=70.54..70.54 rows=127 width=14) |
| -> Seq Scan on tbl_purchase_contracts pc (cost=0.00..70.54 rows=127 width=14) |
| Filter: (supplier_id = 46) |
| -> Materialize (cost=72.12..111.87 rows=113 width=12) |
| -> Subquery Scan on pcr (cost=72.12..111.31 rows=113 width=12) |
| -> GroupAggregate (cost=72.12..110.18 rows=113 width=12) |
| Group Key: pc_1.supplier_id |
| -> Hash Join (cost=72.12..108.45 rows=120 width=8) |
| Hash Cond: (pcr_1.contract_id = pc_1.id) |
| -> Seq Scan on tbl_purchase_client_rels pcr_1 (cost=0.00..31.05 rows=2005 width=8) |
| -> Hash (cost=70.54..70.54 rows=127 width=8) |
| -> Seq Scan on tbl_purchase_contracts pc_1 (cost=0.00..70.54 rows=127 width=8) |
| Filter: (supplier_id = 46) |
| -> Hash (cost=111.31..111.31 rows=113 width=12) |
| -> Subquery Scan on pcr2 (cost=72.12..111.31 rows=113 width=12) |
| -> GroupAggregate (cost=72.12..110.18 rows=113 width=12) |
| Group Key: pc_2.supplier_id |
| -> Hash Join (cost=72.12..108.45 rows=120 width=8) |
| Hash Cond: (pcr_2.contract_id = pc_2.id) |
| -> Seq Scan on tbl_purchase_client_rels pcr_2 (cost=0.00..31.05 rows=2005 width=8) |
| -> Hash (cost=70.54..70.54 rows=127 width=8) |
| -> Seq Scan on tbl_purchase_contracts pc_2 (cost=0.00..70.54 rows=127 width=8) |
| Filter: (supplier_id = 46) |