QUERY PLAN
Aggregate (cost=38.83..38.84 rows=1 width=64)
-> GroupAggregate (cost=38.62..38.75 rows=5 width=68)
Group Key: p.id
-> Sort (cost=38.62..38.63 rows=5 width=14)
Sort Key: p.id
-> Nested Loop (cost=0.28..38.56 rows=5 width=14)
-> Seq Scan on tbl_erp_inventory_products eip (cost=0.00..1.07 rows=5 width=14)
Filter: (inventory > '0'::numeric)
-> Index Scan using tbl_products_pkey on tbl_products p (cost=0.28..7.49 rows=1 width=20)
Index Cond: (id = eip.product_id)