| Aggregate (cost=114.01..114.02 rows=1 width=8) |
| -> Sort (cost=113.74..113.78 rows=18 width=546) |
| Sort Key: sub.wrote_date DESC |
| -> Result (cost=36.49..113.36 rows=18 width=546) |
| -> Append (cost=36.49..113.18 rows=18 width=4) |
| -> Subquery Scan on sub (cost=36.49..36.52 rows=1 width=4) |
| -> GroupAggregate (cost=36.49..36.51 rows=1 width=546) |
| Group Key: r.id |
| Filter: (sum(eip.inventory) > '0'::numeric) |
| -> Sort (cost=36.49..36.50 rows=1 width=11) |
| Sort Key: r.id |
| -> Nested Loop (cost=0.14..36.48 rows=1 width=11) |
| Join Filter: (rp.id = eip.erp_purchase_inbound_product_id) |
| -> Nested Loop (cost=0.14..20.74 rows=1 width=12) |
| -> Seq Scan on tbl_erp_purchase_inbound_products rp (cost=0.00..12.50 rows=1 width=8) |
| Filter: (product_id = 2265) |
| -> Index Scan using tbl_erp_purchase_inbounds_pkey on tbl_erp_purchase_inbounds r (cost=0.14..8.16 rows=1 width=8) |
| Index Cond: (id = rp.erp_purchase_inbound_id) |
| Filter: (status = ANY ('{2,5}'::integer[])) |
| -> Seq Scan on tbl_erp_inventory_products eip (cost=0.00..15.64 rows=8 width=11) |
| Filter: (erp_store_id = 2) |
| -> Subquery Scan on "*SELECT* 2" (cost=19.44..19.79 rows=10 width=4) |
| -> GroupAggregate (cost=19.44..19.69 rows=10 width=546) |
| Group Key: r_1.id |
| Filter: (max((sum(eip_1.inventory))) > '0'::numeric) |
| -> Merge Left Join (cost=19.44..19.54 rows=10 width=40) |
| 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.55..2.58 rows=10 width=12) |
| Sort Key: r_1.id |
| -> Hash Left Join (cost=1.18..2.39 rows=10 width=12) |
| 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=8) |
| Filter: (status = ANY ('{1,2,5}'::integer[])) |
| -> Hash (cost=1.17..1.17 rows=1 width=4) |
| -> Subquery Scan on build_out (cost=1.15..1.17 rows=1 width=4) |
| -> HashAggregate (cost=1.15..1.16 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=4) |
| Filter: (product_id = 2265) |
| -> Materialize (cost=16.89..16.92 rows=1 width=36) |
| -> GroupAggregate (cost=16.89..16.91 rows=1 width=164) |
| Group Key: rp_1.erp_inventory_build_id |
| -> Sort (cost=16.89..16.89 rows=1 width=7) |
| Sort Key: rp_1.erp_inventory_build_id |
| -> Nested Loop (cost=0.00..16.88 rows=1 width=7) |
| Join Filter: (rp_1.id = eip_1.erp_inventory_build_product_id) |
| -> Seq Scan on tbl_erp_inventory_build_products rp_1 (cost=0.00..1.14 rows=1 width=8) |
| Filter: (product_id = 2265) |
| -> Seq Scan on tbl_erp_inventory_products eip_1 (cost=0.00..15.64 rows=8 width=11) |
| Filter: (erp_store_id = 2) |
| -> Subquery Scan on "*SELECT* 3" (cost=19.06..19.23 rows=4 width=4) |
| -> GroupAggregate (cost=19.06..19.19 rows=4 width=546) |
| Group Key: r_2.id |
| Filter: (max((sum(eip_2.inventory))) > '0'::numeric) |
| -> Merge Left Join (cost=19.06..19.13 rows=4 width=40) |
| 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.22..2.23 rows=4 width=12) |
| Sort Key: r_2.id |
| -> Hash Left Join (cost=1.08..2.18 rows=4 width=12) |
| 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=8) |
| Filter: (status = ANY ('{1,2,5}'::integer[])) |
| -> Hash (cost=1.07..1.07 rows=1 width=4) |
| -> Subquery Scan on disassemble_out (cost=1.05..1.07 rows=1 width=4) |
| -> HashAggregate (cost=1.05..1.06 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=4) |
| Filter: (product_id = 2265) |
| -> Materialize (cost=16.85..16.88 rows=1 width=36) |
| -> GroupAggregate (cost=16.85..16.87 rows=1 width=164) |
| Group Key: rp_2.erp_inventory_disassemble_id |
| -> Sort (cost=16.85..16.85 rows=1 width=7) |
| Sort Key: rp_2.erp_inventory_disassemble_id |
| -> Nested Loop (cost=0.00..16.84 rows=1 width=7) |
| Join Filter: (rp_2.id = eip_2.erp_inventory_disassemble_product_id) |
| -> Seq Scan on tbl_erp_inventory_disassemble_products rp_2 (cost=0.00..1.10 rows=1 width=8) |
| Filter: (product_id = 2265) |
| -> Seq Scan on tbl_erp_inventory_products eip_2 (cost=0.00..15.64 rows=8 width=11) |
| Filter: (erp_store_id = 2) |
| -> Subquery Scan on "*SELECT* 4" (cost=18.84..18.87 rows=1 width=4) |
| -> GroupAggregate (cost=18.84..18.86 rows=1 width=546) |
| Group Key: r_3.id |
| Filter: (sum(eip_3.inventory) > '0'::numeric) |
| -> Sort (cost=18.84..18.84 rows=1 width=11) |
| Sort Key: r_3.id |
| -> Nested Loop (cost=1.64..18.82 rows=1 width=11) |
| Join Filter: (rp_3.id = eip_3.erp_inventory_start_product_id) |
| -> Hash Join (cost=1.64..3.09 rows=1 width=12) |
| Hash Cond: (r_3.id = rp_3.erp_inventory_start_id) |
| -> Seq Scan on tbl_erp_inventory_starts r_3 (cost=0.00..1.32 rows=32 width=8) |
| -> Hash (cost=1.62..1.62 rows=1 width=8) |
| -> Seq Scan on tbl_erp_inventory_start_products rp_3 (cost=0.00..1.62 rows=1 width=8) |
| Filter: (product_id = 2265) |
| -> Seq Scan on tbl_erp_inventory_products eip_3 (cost=0.00..15.64 rows=8 width=11) |
| Filter: (erp_store_id = 2) |
| -> Subquery Scan on "*SELECT* 5" (cost=0.00..0.02 rows=1 width=4) |
| -> HashAggregate (cost=0.00..0.01 rows=1 width=546) |
| Group Key: id |
| -> Result (cost=0.00..0.00 rows=0 width=8) |
| One-Time Filter: false |
| -> Subquery Scan on "*SELECT* 6" (cost=18.72..18.76 rows=1 width=4) |
| -> GroupAggregate (cost=18.72..18.75 rows=1 width=546) |
| Group Key: r_4.id |
| Filter: (sum(eip_4.inventory) > '0'::numeric) |
| -> Sort (cost=18.72..18.73 rows=1 width=11) |
| Sort Key: r_4.id |
| -> Nested Loop (cost=0.00..18.71 rows=1 width=11) |
| Join Filter: (rp_4.erp_purchase_gift_id = r_4.id) |
| -> Nested Loop (cost=0.00..17.23 rows=1 width=7) |
| Join Filter: (rp_4.id = eip_4.erp_purchase_gift_product_id) |
| -> Seq Scan on tbl_erp_purchase_gift_products rp_4 (cost=0.00..1.49 rows=1 width=8) |
| Filter: (product_id = 2265) |
| -> Seq Scan on tbl_erp_inventory_products eip_4 (cost=0.00..15.64 rows=8 width=11) |
| Filter: (erp_store_id = 2) |
| -> Seq Scan on tbl_erp_purchase_gifts r_4 (cost=0.00..1.27 rows=17 width=8) |
| Filter: (status = ANY ('{2,5}'::integer[])) |