QUERY PLAN
Aggregate (cost=369.63..369.64 rows=1 width=8)
-> Sort (cost=342.28..346.84 rows=1823 width=891)
Sort Key: ip.created_at
-> HashAggregate (cost=225.32..243.55 rows=1823 width=891)
Group Key: ip.id, pci.id
-> Hash Right Join (cost=162.43..216.20 rows=1823 width=16)
Hash Cond: (pip.purchase_invoice_id = pci.id)
-> Seq Scan on tbl_purchase_invoice_projects pip (cost=0.00..30.43 rows=1943 width=8)
-> Hash (cost=139.64..139.64 rows=1823 width=16)
-> Hash Left Join (cost=77.61..139.64 rows=1823 width=16)
Hash Cond: (ip.purchase_invoice_id = pci.id)
-> Seq Scan on tbl_inventory_products ip (cost=0.00..57.23 rows=1823 width=16)
-> Hash (cost=50.05..50.05 rows=2205 width=8)
-> Seq Scan on tbl_purchase_contract_invoices pci (cost=0.00..50.05 rows=2205 width=8)