QUERY PLAN
Aggregate (cost=636.66..636.67 rows=1 width=96)
-> Hash Left Join (cost=404.97..621.60 rows=2007 width=44)
Hash Cond: (pc.id = pci.contract_id)
-> Hash Left Join (cost=276.31..487.66 rows=2007 width=16)
Hash Cond: (pc.id = pcp.contract_id)
-> Seq Scan on tbl_purchase_contracts pc (cost=0.00..206.07 rows=2007 width=14)
-> Hash (cost=251.23..251.23 rows=2007 width=10)
-> Subquery Scan on pcp (cost=211.09..251.23 rows=2007 width=10)
-> HashAggregate (cost=211.09..231.16 rows=2007 width=10)
Group Key: tbl_purchase_contracts.id
-> Seq Scan on tbl_purchase_contracts (cost=0.00..206.07 rows=2007 width=10)
-> Hash (cost=104.52..104.52 rows=1931 width=36)
-> Subquery Scan on pci (cost=61.08..104.52 rows=1931 width=36)
-> HashAggregate (cost=61.08..85.21 rows=1931 width=36)
Group Key: tbl_purchase_contract_invoices.contract_id
-> Seq Scan on tbl_purchase_contract_invoices (cost=0.00..50.05 rows=2205 width=10)