| Limit (cost=122.45..122.50 rows=20 width=417) |
| -> Sort (cost=122.45..122.56 rows=44 width=417) |
| Sort Key: r.wrote_date DESC |
| -> Append (cost=36.04..121.28 rows=44 width=417) |
| -> GroupAggregate (cost=36.04..36.15 rows=2 width=407) |
| Group Key: r.id |
| Filter: (sum(eip.inventory) > '0'::numeric) |
| -> Sort (cost=36.04..36.04 rows=2 width=102) |
| Sort Key: r.id |
| -> Nested Loop Left Join (cost=27.14..36.03 rows=2 width=102) |
| -> Hash Join (cost=27.01..35.70 rows=2 width=95) |
| Hash Cond: (r.id = rp.erp_purchase_inbound_id) |
| -> Seq Scan on tbl_erp_purchase_inbounds r (cost=0.00..7.66 rows=201 width=67) |
| Filter: (status = ANY ('{2,5}'::integer[])) |
| -> Hash (cost=26.99..26.99 rows=2 width=32) |
| -> Hash Right Join (cost=12.53..26.99 rows=2 width=32) |
| Hash Cond: (eip.erp_purchase_inbound_product_id = rp.id) |
| -> Seq Scan on tbl_erp_inventory_products eip (cost=0.00..13.11 rows=511 width=11) |
| -> Hash (cost=12.50..12.50 rows=2 width=29) |
| -> Seq Scan on tbl_erp_purchase_inbound_products rp (cost=0.00..12.50 rows=2 width=29) |
| Filter: (product_id = 1562) |
| -> Index Scan using tbl_erp_stores_pkey on tbl_erp_stores s (cost=0.13..0.17 rows=1 width=15) |
| Index Cond: (eip.erp_store_id = id) |
| -> GroupAggregate (cost=20.86..22.16 rows=10 width=401) |
| Group Key: r_1.id |
| Filter: (max((sum(eip_1.inventory))) > '0'::numeric) |
| -> Merge Left Join (cost=20.86..21.76 rows=10 width=285) |
| Merge Cond: (r_1.id = rp_1.erp_inventory_build_id) |
| Filter: ((rp_1.erp_inventory_build_id IS NOT NULL) OR (build_out.erp_inventory_build_id IS NOT NULL)) |
| -> Sort (cost=2.56..2.59 rows=10 width=129) |
| Sort Key: r_1.id |
| -> Hash Left Join (cost=1.19..2.40 rows=10 width=129) |
| Hash Cond: (r_1.id = build_out.erp_inventory_build_id) |
| -> Seq Scan on tbl_erp_inventory_builds r_1 (cost=0.00..1.17 rows=10 width=61) |
| Filter: (status = ANY ('{1,2,5}'::integer[])) |
| -> Hash (cost=1.18..1.18 rows=1 width=68) |
| -> Subquery Scan on build_out (cost=1.16..1.18 rows=1 width=68) |
| -> HashAggregate (cost=1.16..1.17 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.15 rows=1 width=14) |
| Filter: (product_id = 1562) |
| -> Materialize (cost=18.29..19.13 rows=1 width=164) |
| -> GroupAggregate (cost=18.29..19.12 rows=1 width=164) |
| Group Key: rp_1.erp_inventory_build_id |
| -> Sort (cost=18.29..18.41 rows=46 width=32) |
| Sort Key: rp_1.erp_inventory_build_id |
| -> Hash Left Join (cost=2.19..17.02 rows=46 width=32) |
| Hash Cond: (eip_1.erp_store_id = s_1.id) |
| -> Hash Right Join (cost=1.15..15.60 rows=46 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..13.11 rows=511 width=25) |
| -> Hash (cost=1.14..1.14 rows=1 width=8) |
| -> Seq Scan on tbl_erp_inventory_build_products rp_1 (cost=0.00..1.14 rows=1 width=8) |
| Filter: (product_id = 1562) |
| -> Hash (cost=1.02..1.02 rows=2 width=15) |
| -> Seq Scan on tbl_erp_stores s_1 (cost=0.00..1.02 rows=2 width=15) |
| -> GroupAggregate (cost=21.28..22.63 rows=4 width=456) |
| Group Key: r_2.id |
| Filter: (max((sum(eip_2.inventory))) > '0'::numeric) |
| -> Merge Left Join (cost=21.28..22.47 rows=4 width=340) |
| Merge Cond: (r_2.id = rp_2.erp_inventory_disassemble_id) |
| Filter: ((rp_2.erp_inventory_disassemble_id IS NOT NULL) OR (disassemble_out.erp_inventory_disassemble_id IS NOT NULL)) |
| -> Sort (cost=2.23..2.24 rows=4 width=184) |
| Sort Key: r_2.id |
| -> Hash Left Join (cost=1.09..2.19 rows=4 width=184) |
| Hash Cond: (r_2.id = disassemble_out.erp_inventory_disassemble_id) |
| -> Seq Scan on tbl_erp_inventory_disassembles r_2 (cost=0.00..1.07 rows=4 width=116) |
| Filter: (status = ANY ('{1,2,5}'::integer[])) |
| -> Hash (cost=1.08..1.08 rows=1 width=68) |
| -> Subquery Scan on disassemble_out (cost=1.06..1.08 rows=1 width=68) |
| -> HashAggregate (cost=1.06..1.07 rows=1 width=68) |
| Group Key: tbl_erp_inventory_disassemble_spent_products.erp_inventory_disassemble_id |
| -> Seq Scan on tbl_erp_inventory_disassemble_spent_products (cost=0.00..1.05 rows=1 width=14) |
| Filter: (product_id = 1562) |
| -> Materialize (cost=19.05..20.21 rows=1 width=164) |
| -> GroupAggregate (cost=19.05..20.20 rows=1 width=164) |
| Group Key: rp_2.erp_inventory_disassemble_id |
| -> Sort (cost=19.05..19.21 rows=64 width=32) |
| Sort Key: rp_2.erp_inventory_disassemble_id |
| -> Hash Left Join (cost=2.16..17.13 rows=64 width=32) |
| Hash Cond: (eip_2.erp_store_id = s_2.id) |
| -> Hash Right Join (cost=1.11..15.56 rows=64 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..13.11 rows=511 width=25) |
| -> Hash (cost=1.10..1.10 rows=1 width=8) |
| -> Seq Scan on tbl_erp_inventory_disassemble_products rp_2 (cost=0.00..1.10 rows=1 width=8) |
| Filter: (product_id = 1562) |
| -> Hash (cost=1.02..1.02 rows=2 width=15) |
| -> Seq Scan on tbl_erp_stores s_2 (cost=0.00..1.02 rows=2 width=15) |
| -> GroupAggregate (cost=19.29..19.84 rows=10 width=427) |
| Group Key: r_3.id |
| Filter: (sum(eip_3.inventory) > '0'::numeric) |
| -> Sort (cost=19.29..19.31 rows=10 width=144) |
| Sort Key: r_3.id |
| -> Nested Loop Left Join (cost=3.36..19.12 rows=10 width=144) |
| Join Filter: (eip_3.erp_store_id = s_3.id) |
| -> Hash Join (cost=3.36..17.85 rows=10 width=137) |
| Hash Cond: (rp_3.erp_inventory_start_id = r_3.id) |
| -> Hash Right Join (cost=1.64..16.10 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..13.11 rows=511 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 = 1562) |
| -> Hash (cost=1.32..1.32 rows=32 width=83) |
| -> Seq Scan on tbl_erp_inventory_starts r_3 (cost=0.00..1.32 rows=32 width=83) |
| -> Materialize (cost=0.00..1.03 rows=2 width=15) |
| -> Seq Scan on tbl_erp_stores s_3 (cost=0.00..1.02 rows=2 width=15) |
| -> GroupAggregate (cost=0.01..0.04 rows=1 width=481) |
| Group Key: id |
| -> Sort (cost=0.01..0.02 rows=0 width=163) |
| Sort Key: id |
| -> Result (cost=0.00..0.00 rows=0 width=163) |
| One-Time Filter: false |
| -> GroupAggregate (cost=19.03..20.03 rows=17 width=409) |
| Group Key: r_4.id |
| Filter: (sum(eip_4.inventory) > '0'::numeric) |
| -> Sort (cost=19.03..19.09 rows=22 width=97) |
| Sort Key: r_4.id |
| -> Hash Left Join (cost=3.83..18.54 rows=22 width=97) |
| Hash Cond: (eip_4.erp_store_id = s_4.id) |
| -> Hash Join (cost=2.79..17.32 rows=22 width=90) |
| Hash Cond: (rp_4.erp_purchase_gift_id = r_4.id) |
| -> Hash Right Join (cost=1.30..15.76 rows=22 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..13.11 rows=511 width=25) |
| -> Hash (cost=1.29..1.29 rows=1 width=8) |
| -> Seq Scan on tbl_erp_purchase_gift_products rp_4 (cost=0.00..1.29 rows=1 width=8) |
| Filter: (product_id = 1562) |
| -> Hash (cost=1.27..1.27 rows=17 width=69) |
| -> Seq Scan on tbl_erp_purchase_gifts r_4 (cost=0.00..1.27 rows=17 width=69) |
| Filter: (status = ANY ('{2,5}'::integer[])) |
| -> Hash (cost=1.02..1.02 rows=2 width=15) |
| -> Seq Scan on tbl_erp_stores s_4 (cost=0.00..1.02 rows=2 width=15) |