Limit (cost=2106.37..2106.42 rows=20 width=202) |
-> Sort (cost=2106.37..2106.49 rows=47 width=202) |
Sort Key: c.signed_at DESC, c.created_at DESC |
-> Group (cost=2101.89..2105.12 rows=47 width=202) |
Group Key: c.id |
-> Nested Loop Left Join (cost=2101.89..2104.65 rows=47 width=194) |
Join Filter: (sgr.sales_id = client.sales_rep) |
-> Merge Left Join (cost=2101.89..2102.33 rows=47 width=198) |
Merge Cond: (c.id = vs.object_id) |
-> Sort (cost=1475.68..1475.79 rows=47 width=198) |
Sort Key: c.id |
-> Hash Right Join (cost=843.62..1474.37 rows=47 width=198) |
Hash Cond: (cs.object_id = c.id) |
-> Seq Scan on tbl_attachement_relationships cs (cost=0.00..624.51 rows=1640 width=4) |
Filter: (object_type = 105) |
-> Hash (cost=843.03..843.03 rows=47 width=198) |
-> Hash Right Join (cost=214.15..843.03 rows=47 width=198) |
Hash Cond: (rs.object_id = c.id) |
-> Seq Scan on tbl_attachement_relationships rs (cost=0.00..624.51 rows=1149 width=4) |
Filter: (object_type = 106) |
-> Hash (cost=213.56..213.56 rows=47 width=198) |
-> Hash Right Join (cost=167.73..213.56 rows=47 width=198) |
Hash Cond: (sci2.contract_id = c.id) |
-> Seq Scan on tbl_sales_contract_invoices sci2 (cost=0.00..38.45 rows=1845 width=4) |
-> Hash (cost=167.23..167.23 rows=40 width=198) |
-> Hash Join (cost=102.27..167.23 rows=40 width=198) |
Hash Cond: (c.client_id = client.id) |
-> Seq Scan on tbl_sales_contracts c (cost=0.00..60.86 rows=1560 width=194) |
Filter: (from_project IS NOT NULL) |
-> Hash (cost=101.64..101.64 rows=50 width=8) |
-> Bitmap Heap Scan on tbl_clients client (cost=14.48..101.64 rows=50 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=626.21..626.36 rows=58 width=4) |
Sort Key: vs.object_id |
-> Seq Scan on tbl_attachement_relationships vs (cost=0.00..624.51 rows=58 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) |