| Aggregate (cost=2349.31..2349.32 rows=1 width=32) |
| -> Hash Join (cost=2280.51..2349.18 rows=49 width=6) |
| Hash Cond: (tbl_sales_contracts.id = "ANY_subquery".id) |
| -> Seq Scan on tbl_sales_contracts (cost=0.00..64.37 rows=1637 width=10) |
| -> Hash (cost=2279.89..2279.89 rows=49 width=4) |
| -> Subquery Scan on "ANY_subquery" (cost=2279.28..2279.89 rows=49 width=4) |
| -> Sort (cost=2279.28..2279.40 rows=49 width=16) |
| Sort Key: c.signed_at DESC, c.created_at DESC |
| -> Group (cost=2277.66..2277.91 rows=49 width=16) |
| Group Key: c.id |
| -> Sort (cost=2277.66..2277.78 rows=49 width=16) |
| Sort Key: c.id |
| -> Hash Right Join (cost=1591.86..2276.28 rows=49 width=16) |
| Hash Cond: (cs.object_id = c.id) |
| -> Seq Scan on tbl_attachement_relationships cs (cost=0.00..678.01 rows=1685 width=4) |
| Filter: (object_type = 105) |
| -> Hash (cost=1591.25..1591.25 rows=49 width=16) |
| -> Hash Right Join (cost=908.81..1591.25 rows=49 width=16) |
| Hash Cond: (rs.object_id = c.id) |
| -> Seq Scan on tbl_attachement_relationships rs (cost=0.00..678.01 rows=1164 width=4) |
| Filter: (object_type = 106) |
| -> Hash (cost=908.20..908.20 rows=49 width=16) |
| -> Hash Right Join (cost=230.01..908.20 rows=49 width=16) |
| Hash Cond: (vs.object_id = c.id) |
| -> Seq Scan on tbl_attachement_relationships vs (cost=0.00..678.01 rows=44 width=4) |
| Filter: (object_type = 107) |
| -> Hash (cost=229.40..229.40 rows=49 width=16) |
| -> Hash Right Join (cost=181.44..229.40 rows=49 width=16) |
| Hash Cond: (sci2.contract_id = c.id) |
| -> Seq Scan on tbl_sales_contract_invoices sci2 (cost=0.00..40.25 rows=1925 width=4) |
| -> Hash (cost=180.92..180.92 rows=42 width=16) |
| -> Nested Loop Left Join (cost=110.06..180.92 rows=42 width=16) |
| Join Filter: (sgr.sales_id = client.sales_rep) |
| -> Hash Join (cost=110.06..178.67 rows=42 width=20) |
| Hash Cond: (c.client_id = client.id) |
| -> Seq Scan on tbl_sales_contracts c (cost=0.00..64.37 rows=1611 width=24) |
| Filter: (from_project IS NOT NULL) |
| -> Hash (cost=109.42..109.42 rows=51 width=8) |
| -> Bitmap Heap Scan on tbl_clients client (cost=14.40..109.42 rows=51 width=8) |
| Recheck Cond: (sales_rep = 1001) |
| -> Bitmap Index Scan on tbl_clients_sales_rep_idx (cost=0.00..4.71 rows=58 width=0) |
| Index Cond: (sales_rep = 1001) |
| -> Materialize (cost=0.00..1.62 rows=1 width=4) |
| -> Seq Scan on tbl_sales_group_relationships sgr (cost=0.00..1.61 rows=1 width=4) |
| Filter: (sales_id = 1001) |