Limit (cost=2096.38..2096.43 rows=20 width=202) |
-> Sort (cost=2096.38..2096.49 rows=47 width=202) |
Sort Key: c.signed_at DESC, c.created_at DESC |
-> Group (cost=2091.89..2095.13 rows=47 width=202) |
Group Key: c.id |
-> Nested Loop Left Join (cost=2091.89..2094.66 rows=47 width=194) |
Join Filter: (sgr.sales_id = client.sales_rep) |
-> Merge Left Join (cost=2091.89..2092.34 rows=47 width=198) |
Merge Cond: (c.id = vs.object_id) |
-> Sort (cost=1468.99..1469.11 rows=47 width=198) |
Sort Key: c.id |
-> Hash Right Join (cost=840.28..1467.69 rows=47 width=198) |
Hash Cond: (cs.object_id = c.id) |
-> Seq Scan on tbl_attachement_relationships cs (cost=0.00..621.20 rows=1631 width=4) |
Filter: (object_type = 105) |
-> Hash (cost=839.69..839.69 rows=47 width=198) |
-> Hash Right Join (cost=214.15..839.69 rows=47 width=198) |
Hash Cond: (rs.object_id = c.id) |
-> Seq Scan on tbl_attachement_relationships rs (cost=0.00..621.20 rows=1142 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=622.90..623.04 rows=58 width=4) |
Sort Key: vs.object_id |
-> Seq Scan on tbl_attachement_relationships vs (cost=0.00..621.20 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) |