| Aggregate (cost=357.66..357.67 rows=1 width=32) |
| -> Nested Loop (cost=316.07..357.35 rows=62 width=10) |
| -> HashAggregate (cost=315.79..316.41 rows=62 width=4) |
| Group Key: tbl_sales_contracts.from_project |
| -> Hash Join (cost=242.76..315.64 rows=62 width=4) |
| Hash Cond: (tbl_sales_contracts.id = c.id) |
| -> Seq Scan on tbl_sales_contracts (cost=0.00..68.32 rows=1732 width=8) |
| -> Hash (cost=241.99..241.99 rows=62 width=4) |
| -> Group (cost=241.06..241.37 rows=62 width=4) |
| Group Key: c.id |
| -> Sort (cost=241.06..241.21 rows=62 width=4) |
| Sort Key: c.id |
| -> Hash Right Join (cost=186.38..239.21 rows=62 width=4) |
| Hash Cond: (sci2.contract_id = c.id) |
| -> Seq Scan on tbl_sales_contract_invoices sci2 (cost=0.00..44.52 rows=2052 width=4) |
| -> Hash (cost=185.73..185.73 rows=52 width=4) |
| -> Nested Loop Left Join (cost=110.51..185.73 rows=52 width=4) |
| Join Filter: (sgr.sales_id = client.sales_rep) |
| -> Hash Join (cost=110.51..183.31 rows=52 width=8) |
| Hash Cond: (c.client_id = client.id) |
| -> Seq Scan on tbl_sales_contracts c (cost=0.00..68.32 rows=1703 width=12) |
| Filter: (from_project IS NOT NULL) |
| -> Hash (cost=109.75..109.75 rows=61 width=8) |
| -> Bitmap Heap Scan on tbl_clients client (cost=14.48..109.75 rows=61 width=8) |
| Recheck Cond: (sales_rep = 1001) |
| -> Bitmap Index Scan on tbl_clients_sales_rep_idx (cost=0.00..4.80 rows=70 width=0) |
| Index Cond: (sales_rep = 1001) |
| -> Materialize (cost=0.00..1.64 rows=1 width=4) |
| -> Seq Scan on tbl_sales_group_relationships sgr (cost=0.00..1.64 rows=1 width=4) |
| Filter: (sales_id = 1001) |
| -> Index Scan using tbl_projects_pkey on tbl_projects (cost=0.28..0.67 rows=1 width=14) |
| Index Cond: (id = tbl_sales_contracts.from_project) |