QUERY PLAN
Sort (cost=72.51..72.67 rows=64 width=166)
Sort Key: eip.created_at DESC
-> HashAggregate (cost=69.95..70.59 rows=64 width=166)
Group Key: eip.id
-> Hash Left Join (cost=62.23..68.47 rows=592 width=166)
Hash Cond: (eip.erp_inventory_overflow_id = eios.id)
-> Hash Right Join (cost=26.40..31.63 rows=64 width=166)
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.60..25.60 rows=64 width=170)
-> Hash Left Join (cost=9.79..25.60 rows=64 width=170)
Hash Cond: (eip.erp_purchase_inbound_id = epis.id)
-> Seq Scan on tbl_erp_inventory_products eip (cost=0.00..15.64 rows=64 width=166)
Filter: ((NOT is_build) AND (inventory > '0'::numeric))
-> Hash (cost=7.13..7.13 rows=213 width=4)
-> Seq Scan on tbl_erp_purchase_inbounds epis (cost=0.00..7.13 rows=213 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)