| Limit (cost=197.51..197.56 rows=20 width=447) |
| -> Sort (cost=197.51..197.61 rows=39 width=447) |
| Sort Key: r.wrote_date DESC |
| -> Append (cost=35.11..196.48 rows=39 width=447) |
| -> GroupAggregate (cost=35.11..35.17 rows=1 width=407) |
| Group Key: r.id |
| Filter: (sum(eip.inventory) > '0'::numeric) |
| -> Sort (cost=35.11..35.12 rows=1 width=608) |
| Sort Key: r.id |
| -> Nested Loop Left Join (cost=12.63..35.10 rows=1 width=608) |
| -> Nested Loop (cost=12.51..34.89 rows=1 width=96) |
| -> Hash Right Join (cost=12.36..26.65 rows=1 width=33) |
| Hash Cond: (eip.erp_purchase_inbound_product_id = rp.id) |
| -> Seq Scan on tbl_erp_inventory_products eip (cost=0.00..12.97 rows=497 width=11) |
| -> Hash (cost=12.35..12.35 rows=1 width=30) |
| -> Seq Scan on tbl_erp_purchase_inbound_products rp (cost=0.00..12.35 rows=1 width=30) |
| Filter: (product_id = 2171) |
| -> Index Scan using tbl_erp_purchase_inbounds_pkey on tbl_erp_purchase_inbounds r (cost=0.14..8.16 rows=1 width=67) |
| Index Cond: (id = rp.erp_purchase_inbound_id) |
| Filter: (status = ANY ('{2,5}'::integer[])) |
| -> Index Scan using tbl_erp_stores_pkey on tbl_erp_stores s (cost=0.12..0.17 rows=1 width=520) |
| Index Cond: (eip.erp_store_id = id) |
| -> GroupAggregate (cost=0.01..0.04 rows=1 width=546) |
| Group Key: id |
| -> Sort (cost=0.01..0.02 rows=0 width=786) |
| Sort Key: id |
| -> Result (cost=0.00..0.00 rows=0 width=786) |
| One-Time Filter: false |
| -> GroupAggregate (cost=0.01..0.04 rows=1 width=546) |
| Group Key: id |
| -> Sort (cost=0.01..0.02 rows=0 width=746) |
| Sort Key: id |
| -> Result (cost=0.00..0.00 rows=0 width=746) |
| One-Time Filter: false |
| -> GroupAggregate (cost=30.31..34.84 rows=2 width=546) |
| Group Key: r_1.id |
| Filter: (max((sum(eip_1.inventory))) > '0'::numeric) |
| -> Nested Loop Left Join (cost=30.31..34.76 rows=2 width=486) |
| Join Filter: (build_out.erp_inventory_build_id = r_1.id) |
| Filter: ((rp_1.erp_inventory_build_id IS NOT NULL) OR (build_out.erp_inventory_build_id IS NOT NULL)) |
| -> Merge Left Join (cost=29.28..33.67 rows=2 width=426) |
| Merge Cond: (r_1.id = rp_1.erp_inventory_build_id) |
| -> Sort (cost=1.04..1.04 rows=2 width=262) |
| Sort Key: r_1.id |
| -> Seq Scan on tbl_erp_inventory_builds r_1 (cost=0.00..1.03 rows=2 width=262) |
| Filter: (status = ANY ('{1,2,5}'::integer[])) |
| -> GroupAggregate (cost=28.24..32.60 rows=1 width=164) |
| Group Key: rp_1.erp_inventory_build_id |
| -> Sort (cost=28.24..28.86 rows=248 width=537) |
| Sort Key: rp_1.erp_inventory_build_id |
| -> Hash Left Join (cost=2.06..18.38 rows=248 width=537) |
| Hash Cond: (eip_1.erp_store_id = s_1.id) |
| -> Hash Right Join (cost=1.04..15.32 rows=248 width=25) |
| Hash Cond: (eip_1.erp_inventory_build_product_id = rp_1.id) |
| -> Seq Scan on tbl_erp_inventory_products eip_1 (cost=0.00..12.97 rows=497 width=25) |
| -> Hash (cost=1.02..1.02 rows=1 width=8) |
| -> Seq Scan on tbl_erp_inventory_build_products rp_1 (cost=0.00..1.02 rows=1 width=8) |
| Filter: (product_id = 2171) |
| -> Hash (cost=1.01..1.01 rows=1 width=520) |
| -> Seq Scan on tbl_erp_stores s_1 (cost=0.00..1.01 rows=1 width=520) |
| -> Materialize (cost=1.03..1.06 rows=1 width=68) |
| -> Subquery Scan on build_out (cost=1.03..1.06 rows=1 width=68) |
| -> HashAggregate (cost=1.03..1.05 rows=1 width=68) |
| Group Key: tbl_erp_inventory_build_spent_products.erp_inventory_build_id |
| -> Seq Scan on tbl_erp_inventory_build_spent_products (cost=0.00..1.02 rows=1 width=68) |
| Filter: (product_id = 2171) |
| -> GroupAggregate (cost=55.52..55.83 rows=3 width=546) |
| Group Key: r_2.id |
| Filter: (max((sum(eip_2.inventory))) > '0'::numeric) |
| -> Merge Left Join (cost=55.52..55.71 rows=3 width=486) |
| Merge Cond: (r_2.id = rp_2.erp_inventory_disassemble_id) |
| Filter: ((rp_2.erp_inventory_disassemble_id IS NOT NULL) OR (tbl_erp_inventory_disassemble_spent_products.erp_inventory_disassemble_id IS NOT NULL)) |
| -> Merge Left Join (cost=28.38..28.48 rows=3 width=330) |
| Merge Cond: (r_2.id = tbl_erp_inventory_disassemble_spent_products.erp_inventory_disassemble_id) |
| -> Sort (cost=12.50..12.51 rows=3 width=262) |
| Sort Key: r_2.id |
| -> Seq Scan on tbl_erp_inventory_disassembles r_2 (cost=0.00..12.47 rows=3 width=262) |
| Filter: (status = ANY ('{1,2,5}'::integer[])) |
| -> GroupAggregate (cost=15.88..15.94 rows=2 width=68) |
| Group Key: tbl_erp_inventory_disassemble_spent_products.erp_inventory_disassemble_id |
| -> Sort (cost=15.88..15.89 rows=2 width=68) |
| Sort Key: tbl_erp_inventory_disassemble_spent_products.erp_inventory_disassemble_id |
| -> Seq Scan on tbl_erp_inventory_disassemble_spent_products (cost=0.00..15.88 rows=2 width=68) |
| Filter: (product_id = 2171) |
| -> Materialize (cost=27.14..27.21 rows=1 width=164) |
| -> GroupAggregate (cost=27.14..27.20 rows=1 width=164) |
| Group Key: rp_2.erp_inventory_disassemble_id |
| -> Sort (cost=27.14..27.15 rows=2 width=537) |
| Sort Key: rp_2.erp_inventory_disassemble_id |
| -> Nested Loop Left Join (cost=12.64..27.13 rows=2 width=537) |
| -> Hash Right Join (cost=12.51..26.79 rows=2 width=25) |
| Hash Cond: (eip_2.erp_inventory_disassemble_product_id = rp_2.id) |
| -> Seq Scan on tbl_erp_inventory_products eip_2 (cost=0.00..12.97 rows=497 width=25) |
| -> Hash (cost=12.50..12.50 rows=1 width=8) |
| -> Seq Scan on tbl_erp_inventory_disassemble_products rp_2 (cost=0.00..12.50 rows=1 width=8) |
| Filter: (product_id = 2171) |
| -> Index Scan using tbl_erp_stores_pkey on tbl_erp_stores s_2 (cost=0.12..0.17 rows=1 width=520) |
| Index Cond: (eip_2.erp_store_id = id) |
| -> GroupAggregate (cost=20.00..20.55 rows=10 width=427) |
| Group Key: r_3.id |
| Filter: (sum(eip_3.inventory) > '0'::numeric) |
| -> Sort (cost=20.00..20.02 rows=10 width=649) |
| Sort Key: r_3.id |
| -> Nested Loop Left Join (cost=4.36..19.83 rows=10 width=649) |
| Join Filter: (eip_3.erp_store_id = s_3.id) |
| -> Hash Join (cost=4.36..18.67 rows=10 width=137) |
| Hash Cond: (rp_3.erp_inventory_start_id = r_3.id) |
| -> Hash Right Join (cost=1.64..15.92 rows=10 width=58) |
| Hash Cond: (eip_3.erp_inventory_start_product_id = rp_3.id) |
| -> Seq Scan on tbl_erp_inventory_products eip_3 (cost=0.00..12.97 rows=497 width=11) |
| -> Hash (cost=1.62..1.62 rows=1 width=55) |
| -> Seq Scan on tbl_erp_inventory_start_products rp_3 (cost=0.00..1.62 rows=1 width=55) |
| Filter: (product_id = 2171) |
| -> Hash (cost=2.32..2.32 rows=32 width=83) |
| -> Seq Scan on tbl_erp_inventory_starts r_3 (cost=0.00..2.32 rows=32 width=83) |
| -> Materialize (cost=0.00..1.01 rows=1 width=520) |
| -> Seq Scan on tbl_erp_stores s_3 (cost=0.00..1.01 rows=1 width=520) |
| -> GroupAggregate (cost=0.01..0.05 rows=1 width=455) |
| Group Key: id |
| -> Sort (cost=0.01..0.02 rows=0 width=651) |
| Sort Key: id |
| -> Result (cost=0.00..0.00 rows=0 width=651) |
| One-Time Filter: false |
| -> GroupAggregate (cost=0.01..0.04 rows=1 width=546) |
| Group Key: id |
| -> Sort (cost=0.01..0.02 rows=0 width=786) |
| Sort Key: id |
| -> Result (cost=0.00..0.00 rows=0 width=786) |
| One-Time Filter: false |
| -> GroupAggregate (cost=19.86..21.29 rows=15 width=409) |
| Group Key: r_4.id |
| Filter: (sum(eip_4.inventory) > '0'::numeric) |
| -> Sort (cost=19.86..19.98 rows=47 width=602) |
| Sort Key: r_4.id |
| -> Hash Left Join (cost=3.75..18.56 rows=47 width=602) |
| Hash Cond: (eip_4.erp_store_id = s_4.id) |
| -> Hash Join (cost=2.72..17.16 rows=47 width=90) |
| Hash Cond: (rp_4.erp_purchase_gift_id = r_4.id) |
| -> Hash Right Join (cost=1.29..15.57 rows=47 width=25) |
| Hash Cond: (eip_4.erp_purchase_gift_product_id = rp_4.id) |
| -> Seq Scan on tbl_erp_inventory_products eip_4 (cost=0.00..12.97 rows=497 width=25) |
| -> Hash (cost=1.26..1.26 rows=2 width=8) |
| -> Seq Scan on tbl_erp_purchase_gift_products rp_4 (cost=0.00..1.26 rows=2 width=8) |
| Filter: (product_id = 2171) |
| -> Hash (cost=1.25..1.25 rows=15 width=69) |
| -> Seq Scan on tbl_erp_purchase_gifts r_4 (cost=0.00..1.25 rows=15 width=69) |
| Filter: (status = ANY ('{2,5}'::integer[])) |
| -> Hash (cost=1.01..1.01 rows=1 width=520) |
| -> Seq Scan on tbl_erp_stores s_4 (cost=0.00..1.01 rows=1 width=520) |
| -> GroupAggregate (cost=27.62..28.20 rows=3 width=451) |
| Group Key: r_5.id |
| Filter: (sum(eip_5.inventory) > '0'::numeric) |
| -> Nested Loop Left Join (cost=27.62..28.05 rows=3 width=636) |
| -> Merge Join (cost=27.49..27.54 rows=3 width=124) |
| Merge Cond: (rp_5.erp_inventory_overflow_id = r_5.id) |
| -> Sort (cost=26.33..26.34 rows=3 width=25) |
| Sort Key: rp_5.erp_inventory_overflow_id |
| -> Hash Right Join (cost=12.01..26.31 rows=3 width=25) |
| Hash Cond: (eip_5.erp_inventory_overflow_product_id = rp_5.id) |
| -> Seq Scan on tbl_erp_inventory_products eip_5 (cost=0.00..12.97 rows=497 width=25) |
| -> Hash (cost=12.00..12.00 rows=1 width=8) |
| -> Seq Scan on tbl_erp_inventory_overflow_products rp_5 (cost=0.00..12.00 rows=1 width=8) |
| Filter: (product_id = 2171) |
| -> Sort (cost=1.16..1.17 rows=5 width=103) |
| Sort Key: r_5.id |
| -> Seq Scan on tbl_erp_inventory_overflows r_5 (cost=0.00..1.10 rows=5 width=103) |
| Filter: (status = ANY ('{2,5}'::integer[])) |
| -> Index Scan using tbl_erp_stores_pkey on tbl_erp_stores s_5 (cost=0.12..0.17 rows=1 width=520) |
| Index Cond: (eip_5.erp_store_id = id) |
| -> GroupAggregate (cost=0.01..0.04 rows=1 width=436) |
| Group Key: id |
| -> Sort (cost=0.01..0.02 rows=0 width=617) |
| Sort Key: id |
| -> Result (cost=0.00..0.00 rows=0 width=617) |
| One-Time Filter: false |