| Aggregate (cost=240.55..240.56 rows=1 width=32) |
| -> Hash Semi Join (cost=225.88..240.24 rows=120 width=32) |
| Hash Cond: (tbl_purchase_contract_invoices.contract_id = tbl_purchase_contracts.id) |
| -> Seq Scan on tbl_purchase_contract_invoices (cost=0.00..12.40 rows=239 width=36) |
| Filter: ((red_invoice_id IS NOT NULL) OR (NOT is_cancel)) |
| -> Hash (cost=225.83..225.83 rows=4 width=8) |
| -> Merge Join (cost=225.75..225.83 rows=4 width=8) |
| Merge Cond: (tbl_purchase_contracts.id = c.id) |
| -> Sort (cost=1.11..1.12 rows=5 width=4) |
| Sort Key: tbl_purchase_contracts.id |
| -> Seq Scan on tbl_purchase_contracts (cost=0.00..1.05 rows=5 width=4) |
| Filter: including_tax |
| -> Sort (cost=224.64..224.65 rows=4 width=4) |
| Sort Key: c.id |
| -> HashAggregate (cost=224.52..224.56 rows=4 width=4) |
| Group Key: c.id |
| -> Hash Left Join (cost=122.93..203.58 rows=8374 width=4) |
| Hash Cond: (pcr.client_id = client.id) |
| Filter: ((client.sales_rep = ANY ('{5495,5493}'::integer[])) OR (client.sales_rep IS NULL) OR (hashed SubPlan 1) OR (pcr.id IS NULL)) |
| -> Hash Right Join (cost=34.31..70.12 rows=1480 width=12) |
| Hash Cond: (pcr.contract_id = c.id) |
| -> Seq Scan on tbl_purchase_client_rels pcr (cost=0.00..28.50 rows=1850 width=12) |
| -> Hash (cost=34.26..34.26 rows=4 width=4) |
| -> Hash Right Join (cost=1.11..34.26 rows=4 width=4) |
| Hash Cond: (cs.object_id = c.id) |
| -> Seq Scan on tbl_attachement_relationships cs (cost=0.00..33.12 rows=9 width=4) |
| Filter: (object_type = 108) |
| -> Hash (cost=1.06..1.06 rows=4 width=8) |
| -> Seq Scan on tbl_purchase_contracts c (cost=0.00..1.06 rows=4 width=8) |
| Filter: ((NOT is_chargeback) AND (NOT is_draft) AND (NOT is_refuse) AND (cost_type = 1)) |
| -> Hash (cost=50.54..50.54 rows=204 width=8) |
| -> Hash Right Join (cost=10.45..50.54 rows=204 width=8) |
| Hash Cond: (sgr.sales_id = client.sales_rep) |
| -> Seq Scan on tbl_sales_group_relationships sgr (cost=0.00..30.40 rows=2040 width=4) |
| -> Hash (cost=10.20..10.20 rows=20 width=8) |
| -> Seq Scan on tbl_clients client (cost=0.00..10.20 rows=20 width=8) |
| SubPlan 1 |
| -> Seq Scan on tbl_user_visit_clients (cost=0.00..35.50 rows=10 width=4) |
| Filter: (user_id = 5495) |