Aggregate (cost=2212.93..2212.94 rows=1 width=32) |
-> Nested Loop (cost=2171.98..2212.69 rows=47 width=10) |
-> HashAggregate (cost=2171.70..2172.17 rows=47 width=4) |
Group Key: tbl_sales_contracts.from_project |
-> Hash Join (cost=2106.55..2171.58 rows=47 width=4) |
Hash Cond: (tbl_sales_contracts.id = "ANY_subquery".id) |
-> Seq Scan on tbl_sales_contracts (cost=0.00..60.86 rows=1586 width=8) |
-> Hash (cost=2105.96..2105.96 rows=47 width=4) |
-> Subquery Scan on "ANY_subquery" (cost=2105.37..2105.96 rows=47 width=4) |
-> Sort (cost=2105.37..2105.49 rows=47 width=16) |
Sort Key: c.signed_at DESC, c.created_at DESC |
-> Group (cost=2103.83..2104.07 rows=47 width=16) |
Group Key: c.id |
-> Sort (cost=2103.83..2103.95 rows=47 width=16) |
Sort Key: c.id |
-> Hash Left Join (cost=1471.13..2102.53 rows=47 width=16) |
Hash Cond: (client.sales_rep = sgr.sales_id) |
-> Hash Right Join (cost=1469.50..2100.26 rows=47 width=20) |
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=1468.92..1468.92 rows=47 width=20) |
-> Hash Right Join (cost=840.03..1468.92 rows=47 width=20) |
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=839.45..839.45 rows=47 width=20) |
-> Hash Right Join (cost=214.71..839.45 rows=47 width=20) |
Hash Cond: (vs.object_id = c.id) |
-> Seq Scan on tbl_attachement_relationships vs (cost=0.00..624.51 rows=58 width=4) |
Filter: (object_type = 107) |
-> Hash (cost=214.12..214.12 rows=47 width=20) |
-> Hash Right Join (cost=168.29..214.12 rows=47 width=20) |
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.79..167.79 rows=40 width=20) |
-> Hash Join (cost=102.82..167.79 rows=40 width=20) |
Hash Cond: (c.client_id = client.id) |
-> Seq Scan on tbl_sales_contracts c (cost=0.00..60.86 rows=1560 width=24) |
Filter: (from_project IS NOT NULL) |
-> Hash (cost=102.19..102.19 rows=51 width=8) |
-> Bitmap Heap Scan on tbl_clients client (cost=14.48..102.19 rows=51 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) |
-> Hash (cost=1.61..1.61 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) |
-> Index Scan using tbl_projects_pkey on tbl_projects (cost=0.28..0.87 rows=1 width=14) |
Index Cond: (id = tbl_sales_contracts.from_project) |