QUERY PLAN
Aggregate (cost=74.96..74.97 rows=1 width=8)
-> Sort (cost=73.87..74.05 rows=73 width=505)
Sort Key: eip.created_at DESC
-> HashAggregate (cost=70.88..71.61 rows=73 width=505)
Group Key: eip.id
-> Hash Left Join (cost=62.72..69.19 rows=675 width=12)
Hash Cond: (eip.erp_inventory_overflow_id = eios.id)
-> Hash Right Join (cost=26.88..32.19 rows=73 width=16)
Hash Cond: (epips.erp_purchase_inbound_id = epis.id)
-> Seq Scan on tbl_erp_purchase_inbound_projects epips (cost=0.00..3.93 rows=193 width=4)
-> Hash (cost=25.97..25.97 rows=73 width=20)
-> Hash Left Join (cost=9.90..25.97 rows=73 width=20)
Hash Cond: (eip.erp_purchase_inbound_id = epis.id)
-> Seq Scan on tbl_erp_inventory_products eip (cost=0.00..15.88 rows=73 width=40)
Filter: ((NOT is_build) AND (inventory > '0'::numeric))
-> Hash (cost=7.18..7.18 rows=218 width=4)
-> Seq Scan on tbl_erp_purchase_inbounds epis (cost=0.00..7.18 rows=218 width=4)
-> Hash (cost=34.68..34.68 rows=92 width=4)
-> Hash Right Join (cost=1.23..34.68 rows=92 width=4)
Hash Cond: (eiops.erp_inventory_overflow_id = eios.id)
-> Seq Scan on tbl_erp_inventory_overflow_projects eiops (cost=0.00..28.50 rows=1850 width=4)
-> Hash (cost=1.10..1.10 rows=10 width=4)
-> Seq Scan on tbl_erp_inventory_overflows eios (cost=0.00..1.10 rows=10 width=4)