QUERY PLAN
Aggregate (cost=358.38..358.39 rows=1 width=8)
-> HashAggregate (cost=300.55..326.25 rows=2570 width=301)
Group Key: pci.id
-> Hash Right Join (cost=164.33..293.01 rows=3018 width=4)
Hash Cond: (pcpp.purchase_invoice_id = pci.id)
-> Seq Scan on tbl_purchase_invoice_products pcpp (cost=0.00..87.18 rows=3018 width=4)
-> Hash (cost=132.21..132.21 rows=2570 width=4)
-> Hash Right Join (cost=92.83..132.21 rows=2570 width=4)
Hash Cond: (pip.purchase_invoice_id = pci.id)
-> Seq Scan on tbl_purchase_invoice_projects pip (cost=0.00..33.68 rows=2168 width=8)
-> Hash (cost=60.70..60.70 rows=2570 width=12)
-> Seq Scan on tbl_purchase_contract_invoices pci (cost=0.00..60.70 rows=2570 width=12)
Filter: (cover_invoice_id IS NULL)