| Limit (cost=2280.37..2280.42 rows=20 width=207) |
| -> Sort (cost=2280.37..2280.50 rows=49 width=207) |
| Sort Key: c.signed_at DESC, c.created_at DESC |
| -> Group (cost=2275.83..2279.07 rows=49 width=207) |
| Group Key: c.id |
| -> Nested Loop Left Join (cost=2275.83..2278.58 rows=49 width=199) |
| Join Filter: (sgr.sales_id = client.sales_rep) |
| -> Merge Left Join (cost=2275.83..2276.23 rows=49 width=203) |
| Merge Cond: (c.id = vs.object_id) |
| -> Sort (cost=1596.62..1596.74 rows=49 width=203) |
| Sort Key: c.id |
| -> Hash Right Join (cost=910.82..1595.24 rows=49 width=203) |
| 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=910.21..910.21 rows=49 width=203) |
| -> Hash Right Join (cost=227.77..910.21 rows=49 width=203) |
| 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=227.16..227.16 rows=49 width=203) |
| -> Hash Right Join (cost=179.20..227.16 rows=49 width=203) |
| 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=178.67..178.67 rows=42 width=203) |
| -> Hash Join (cost=110.06..178.67 rows=42 width=203) |
| Hash Cond: (c.client_id = client.id) |
| -> Seq Scan on tbl_sales_contracts c (cost=0.00..64.37 rows=1611 width=199) |
| 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) |
| -> Sort (cost=679.21..679.32 rows=44 width=4) |
| Sort Key: vs.object_id |
| -> Seq Scan on tbl_attachement_relationships vs (cost=0.00..678.01 rows=44 width=4) |
| Filter: (object_type = 107) |
| -> 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) |