QUERY PLAN
Nested Loop Left Join (cost=0.70..19.85 rows=1 width=645)
Join Filter: (eip.erp_inventory_build_id = eib.id)
Filter: ((eip.erp_inventory_build_id IS NULL) OR (eib.status <> 6))
-> Nested Loop Left Join (cost=0.70..18.80 rows=1 width=649)
Join Filter: (eip.erp_inventory_overflow_id = eio.id)
Filter: ((eip.erp_inventory_overflow_id IS NULL) OR (eio.status <> 6))
-> Nested Loop Left Join (cost=0.70..17.60 rows=1 width=653)
Filter: ((eip.erp_inventory_disassemble_id IS NULL) OR (eid.status <> 6))
-> Nested Loop Left Join (cost=0.55..14.28 rows=1 width=657)
Filter: ((eip.erp_purchase_gift_id IS NULL) OR (epg.status <> 6))
-> Nested Loop Left Join (cost=0.42..13.26 rows=1 width=661)
Filter: ((eip.erp_purchase_inbound_id IS NULL) OR (epi.status <> 6))
-> Nested Loop (cost=0.27..10.80 rows=1 width=665)
-> Seq Scan on tbl_erp_inventory_product_sns eipsn (cost=0.00..1.44 rows=1 width=645)
Filter: ((sn)::text = '3123'::text)
-> Index Scan using tbl_erp_inventory_products_pkey on tbl_erp_inventory_products eip (cost=0.27..8.29 rows=1 width=24)
Index Cond: (id = eipsn.erp_inventory_product_id)
Filter: (product_id = 2269)
-> Index Scan using tbl_erp_purchase_inbounds_pkey on tbl_erp_purchase_inbounds epi (cost=0.14..2.45 rows=1 width=6)
Index Cond: (eip.erp_purchase_inbound_id = id)
-> Index Scan using tbl_erp_purchase_gifts_pkey on tbl_erp_purchase_gifts epg (cost=0.14..1.01 rows=1 width=6)
Index Cond: (eip.erp_purchase_gift_id = id)
-> Index Scan using tbl_erp_inventory_disassembles_pkey on tbl_erp_inventory_disassembles eid (cost=0.14..3.31 rows=1 width=6)
Index Cond: (eip.erp_inventory_disassemble_id = id)
-> Seq Scan on tbl_erp_inventory_overflows eio (cost=0.00..1.08 rows=8 width=6)
-> Seq Scan on tbl_erp_inventory_builds eib (cost=0.00..1.02 rows=2 width=6)