QUERY PLAN
GroupAggregate (cost=120.08..121.07 rows=36 width=84)
Group Key: gc.id
-> Sort (cost=120.08..120.17 rows=36 width=33)
Sort Key: gc.id
-> Nested Loop Left Join (cost=98.87..119.15 rows=36 width=33)
-> Hash Join (cost=98.72..113.03 rows=36 width=17)
Hash Cond: (eip.product_id = prod.id)
-> Seq Scan on tbl_erp_inventory_products eip (cost=0.00..14.21 rows=36 width=17)
Filter: (((erp_purchase_inbound_id IS NOT NULL) OR (erp_purchase_gift_id IS NOT NULL) OR (erp_inventory_build_id IS NOT NULL) OR (erp_inventory_disassemble_id IS NOT NULL) OR (erp_inventory_start_id IS NOT NULL)) AND (inventory > '0'::numeric))
-> Hash (cost=72.21..72.21 rows=2121 width=8)
-> Seq Scan on tbl_products prod (cost=0.00..72.21 rows=2121 width=8)
-> Index Scan using tbl_product_components_pkey on tbl_product_components gc (cost=0.14..0.17 rows=1 width=20)
Index Cond: (id = prod.product_component)