QUERY PLAN
Limit (cost=88.83..88.84 rows=1 width=89)
-> Group (cost=88.83..88.84 rows=1 width=89)
Group Key: esops.id
-> Sort (cost=88.83..88.84 rows=1 width=89)
Sort Key: esops.id
-> Nested Loop (cost=0.00..88.82 rows=1 width=89)
Join Filter: (eips.erp_store_id = salestore.id)
-> Nested Loop (cost=0.00..87.78 rows=1 width=93)
Join Filter: (esops.product_id = eips.product_id)
-> Seq Scan on tbl_erp_sales_order_products esops (cost=0.00..71.34 rows=1 width=89)
Filter: ((erp_sales_order_id = 1700) AND (((number - outbound) > '0'::numeric) OR (id = ANY ('{2231,2232}'::integer[]))))
-> Seq Scan on tbl_erp_inventory_products eips (cost=0.00..15.64 rows=64 width=8)
Filter: (inventory > '0'::numeric)
-> Seq Scan on tbl_erp_stores salestore (cost=0.00..1.02 rows=2 width=4)
Filter: (NOT is_delete)