QUERY PLAN
Nested Loop Left Join (cost=20.79..42.86 rows=1 width=142)
Filter: ((eip.erp_inventory_disassemble_id IS NULL) OR (eid.status <> 6))
-> Nested Loop Left Join (cost=20.65..41.89 rows=1 width=146)
Filter: ((eip.erp_inventory_build_id IS NULL) OR (eib.status <> 6))
-> Nested Loop Left Join (cost=20.52..40.93 rows=1 width=150)
Filter: ((eip.erp_inventory_overflow_id IS NULL) OR (eio.status <> 6))
-> Nested Loop Left Join (cost=20.38..39.96 rows=1 width=154)
Filter: ((eip.erp_purchase_gift_id IS NULL) OR (epg.status <> 6))
-> Nested Loop Left Join (cost=20.25..39.00 rows=1 width=158)
Filter: ((eip.erp_purchase_inbound_id IS NULL) OR (epi.status <> 6))
-> Nested Loop (cost=20.10..36.95 rows=1 width=162)
Join Filter: (eipsn.erp_inventory_product_id = eip.id)
-> Seq Scan on tbl_erp_inventory_products eip (cost=0.00..14.39 rows=15 width=24)
Filter: (product_id = 2269)
-> Materialize (cost=20.10..22.12 rows=2 width=142)
-> Seq Scan on tbl_erp_inventory_product_sns eipsn (cost=20.10..22.11 rows=2 width=142)
Filter: ((NOT (hashed SubPlan 1)) AND ((sn)::text = ANY ('{1,2,3,4,5}'::text[])))
SubPlan 1
-> Nested Loop (cost=0.00..20.10 rows=1 width=14)
-> Nested Loop (cost=0.00..12.43 rows=1 width=18)
Join Filter: (pps.erp_purchase_inbound_product_id = pp.id)
-> Seq Scan on tbl_erp_purchase_inbound_products pp (cost=0.00..10.41 rows=1 width=8)
Filter: (erp_purchase_inbound_id = 214)
-> Seq Scan on tbl_erp_purchase_inbound_product_sns pps (cost=0.00..1.45 rows=45 width=18)
-> Seq Scan on tbl_erp_purchase_inbounds p (cost=0.00..7.66 rows=1 width=4)
Filter: (id = 214)
-> Index Scan using tbl_erp_purchase_inbounds_pkey on tbl_erp_purchase_inbounds epi (cost=0.14..2.03 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..0.95 rows=1 width=6)
Index Cond: (eip.erp_purchase_gift_id = id)
-> Index Scan using tbl_erp_inventory_overflows_pkey on tbl_erp_inventory_overflows eio (cost=0.14..0.95 rows=1 width=6)
Index Cond: (eip.erp_inventory_overflow_id = id)
-> Index Scan using tbl_erp_inventory_builds_pkey on tbl_erp_inventory_builds eib (cost=0.14..0.95 rows=1 width=6)
Index Cond: (eip.erp_inventory_build_id = id)
-> Index Scan using tbl_erp_inventory_disassembles_pkey on tbl_erp_inventory_disassembles eid (cost=0.13..0.95 rows=1 width=6)
Index Cond: (eip.erp_inventory_disassemble_id = id)