QUERY PLAN
Sort (cost=12.73..12.73 rows=1 width=417)
Sort Key: eip.wrote_date, eip.created_at
-> Group (cost=12.71..12.72 rows=1 width=417)
Group Key: eip.id
-> Sort (cost=12.71..12.71 rows=1 width=417)
Sort Key: eip.id
-> Seq Scan on tbl_erp_inventory_products eip (cost=0.00..12.70 rows=1 width=417)
Filter: ((inventory > '0'::numeric) AND (product_id = 947))