| Limit (cost=233.04..233.05 rows=1 width=211) |
| -> Sort (cost=233.04..233.05 rows=1 width=211) |
| Sort Key: c.signed_at DESC, c.created_at DESC |
| -> Group (cost=233.02..233.03 rows=1 width=211) |
| Group Key: c.id |
| -> Sort (cost=233.02..233.02 rows=1 width=203) |
| Sort Key: c.id |
| -> Nested Loop Left Join (cost=133.51..233.01 rows=1 width=203) |
| Join Filter: (sgr.sales_id = client.sales_rep) |
| -> Hash Join (cost=133.51..231.36 rows=1 width=207) |
| Hash Cond: (client.id = c.client_id) |
| -> Bitmap Heap Scan on tbl_clients client (cost=14.48..109.58 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) |
| -> Hash (cost=118.60..118.60 rows=34 width=203) |
| -> Hash Right Join (cost=68.68..118.60 rows=34 width=203) |
| 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=68.32..68.32 rows=29 width=203) |
| -> Seq Scan on tbl_sales_contracts c (cost=0.00..68.32 rows=29 width=203) |
| Filter: ((from_project IS NULL) AND build_by_project) |
| -> Seq Scan on tbl_sales_group_relationships sgr (cost=0.00..1.64 rows=1 width=4) |
| Filter: (sales_id = 1001) |