Limit (cost=1699.36..1699.41 rows=20 width=202) |
-> Sort (cost=1699.36..1699.47 rows=47 width=202) |
Sort Key: c.signed_at DESC, c.created_at DESC |
-> Group (cost=1694.95..1698.10 rows=47 width=202) |
Group Key: c.id |
-> Nested Loop Left Join (cost=1694.95..1697.63 rows=47 width=194) |
Join Filter: (sgr.sales_id = client.sales_rep) |
-> Merge Left Join (cost=1694.95..1695.31 rows=47 width=198) |
Merge Cond: (c.id = vs.object_id) |
-> Sort (cost=1261.09..1261.21 rows=47 width=198) |
Sort Key: c.id |
-> Hash Right Join (cost=820.21..1259.79 rows=47 width=198) |
Hash Cond: (cs.object_id = c.id) |
-> Seq Scan on tbl_attachement_relationships cs (cost=0.00..433.06 rows=1714 width=4) |
Filter: (object_type = 105) |
-> Hash (cost=819.62..819.62 rows=47 width=198) |
-> Hash Right Join (cost=382.00..819.62 rows=47 width=198) |
Hash Cond: (rs.object_id = c.id) |
-> Seq Scan on tbl_attachement_relationships rs (cost=0.00..433.06 rows=1198 width=4) |
Filter: (object_type = 106) |
-> Hash (cost=381.42..381.42 rows=47 width=198) |
-> Hash Right Join (cost=335.73..381.42 rows=47 width=198) |
Hash Cond: (sci2.contract_id = c.id) |
-> Seq Scan on tbl_sales_contract_invoices sci2 (cost=0.00..38.34 rows=1834 width=4) |
-> Hash (cost=335.22..335.22 rows=41 width=198) |
-> Hash Join (cost=104.28..335.22 rows=41 width=198) |
Hash Cond: (c.client_id = client.id) |
-> Seq Scan on tbl_sales_contracts c (cost=0.00..226.84 rows=1558 width=194) |
Filter: (from_project IS NOT NULL) |
-> Hash (cost=103.63..103.63 rows=52 width=8) |
-> Bitmap Heap Scan on tbl_clients client (cost=14.49..103.63 rows=52 width=8) |
Recheck Cond: (sales_rep = 1001) |
-> Bitmap Index Scan on tbl_clients_sales_rep_idx (cost=0.00..4.72 rows=59 width=0) |
Index Cond: (sales_rep = 1001) |
-> Sort (cost=433.86..433.94 rows=32 width=4) |
Sort Key: vs.object_id |
-> Seq Scan on tbl_attachement_relationships vs (cost=0.00..433.06 rows=32 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) |