Limit (cost=2102.40..2102.42 rows=10 width=201) |
-> Sort (cost=2102.40..2102.52 rows=50 width=201) |
Sort Key: c.signed_at DESC, c.created_at DESC |
-> Group (cost=2098.05..2101.32 rows=50 width=201) |
Group Key: c.id |
-> Nested Loop Left Join (cost=2098.05..2100.82 rows=50 width=193) |
Join Filter: (sgr.sales_id = client.sales_rep) |
-> Merge Left Join (cost=2098.05..2098.45 rows=50 width=197) |
Merge Cond: (c.id = vs.object_id) |
-> Sort (cost=1454.32..1454.44 rows=50 width=197) |
Sort Key: c.id |
-> Hash Right Join (cost=804.05..1452.91 rows=50 width=197) |
Hash Cond: (cs.object_id = c.id) |
-> Seq Scan on tbl_attachement_relationships cs (cost=0.00..642.56 rows=1655 width=4) |
Filter: (object_type = 105) |
-> Hash (cost=803.42..803.42 rows=50 width=197) |
-> Hash Right Join (cost=156.49..803.42 rows=50 width=197) |
Hash Cond: (rs.object_id = c.id) |
-> Seq Scan on tbl_attachement_relationships rs (cost=0.00..642.56 rows=1146 width=4) |
Filter: (object_type = 106) |
-> Hash (cost=155.87..155.87 rows=50 width=197) |
-> Hash Join (cost=87.76..155.87 rows=50 width=197) |
Hash Cond: (c.client_id = client.id) |
-> Seq Scan on tbl_sales_contracts c (cost=0.00..63.71 rows=1671 width=193) |
-> Hash (cost=87.03..87.03 rows=58 width=8) |
-> Bitmap Heap Scan on tbl_clients client (cost=4.73..87.03 rows=58 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=643.73..643.84 rows=43 width=4) |
Sort Key: vs.object_id |
-> Seq Scan on tbl_attachement_relationships vs (cost=0.00..642.56 rows=43 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) |