| Limit (cost=348.92..348.97 rows=20 width=434) |
| -> Sort (cost=348.92..349.13 rows=83 width=434) |
| Sort Key: r.wrote_date DESC |
| -> Append (cost=39.26..346.71 rows=83 width=434) |
| -> GroupAggregate (cost=39.26..39.71 rows=9 width=411) |
| Group Key: r.id |
| -> Sort (cost=39.26..39.29 rows=9 width=105) |
| Sort Key: r.id |
| -> Nested Loop Left Join (cost=21.89..39.12 rows=9 width=105) |
| Join Filter: (eip.erp_store_id = s.id) |
| -> Hash Join (cost=21.89..37.87 rows=9 width=98) |
| Hash Cond: (rp.erp_purchase_inbound_id = r.id) |
| -> Hash Right Join (cost=11.60..27.55 rows=9 width=31) |
| Hash Cond: (eip.erp_purchase_inbound_product_id = rp.id) |
| -> Seq Scan on tbl_erp_inventory_products eip (cost=0.00..14.50 rows=550 width=11) |
| -> Hash (cost=11.51..11.51 rows=7 width=28) |
| -> Seq Scan on tbl_erp_purchase_inbound_products rp (cost=0.00..11.51 rows=7 width=28) |
| Filter: (product_id = 2261) |
| -> Hash (cost=7.72..7.72 rows=205 width=71) |
| -> Seq Scan on tbl_erp_purchase_inbounds r (cost=0.00..7.72 rows=205 width=71) |
| Filter: (status = ANY ('{2,5}'::integer[])) |
| -> Materialize (cost=0.00..1.03 rows=2 width=15) |
| -> Seq Scan on tbl_erp_stores s (cost=0.00..1.02 rows=2 width=15) |
| -> GroupAggregate (cost=10.61..26.71 rows=1 width=471) |
| Group Key: r_1.id |
| -> Nested Loop Left Join (cost=10.61..26.68 rows=1 width=152) |
| -> Nested Loop Left Join (cost=10.49..26.48 rows=1 width=145) |
| -> Merge Join (cost=2.18..2.22 rows=1 width=145) |
| Merge Cond: (r_1.id = rp_1.erp_purchase_return_id) |
| -> Sort (cost=1.10..1.11 rows=3 width=131) |
| Sort Key: r_1.id |
| -> Seq Scan on tbl_erp_purchase_returns r_1 (cost=0.00..1.07 rows=3 width=131) |
| Filter: (status = ANY ('{2,5}'::integer[])) |
| -> Sort (cost=1.08..1.09 rows=1 width=18) |
| Sort Key: rp_1.erp_purchase_return_id |
| -> Seq Scan on tbl_erp_purchase_return_products rp_1 (cost=0.00..1.07 rows=1 width=18) |
| Filter: (product_id = 2261) |
| -> Hash Right Join (cost=8.30..24.26 rows=1 width=8) |
| Hash Cond: (eip_1.erp_purchase_inbound_product_id = epip.id) |
| -> Seq Scan on tbl_erp_inventory_products eip_1 (cost=0.00..14.50 rows=550 width=8) |
| -> Hash (cost=8.29..8.29 rows=1 width=4) |
| -> Index Only Scan using tbl_erp_purchase_inbound_products_pkey on tbl_erp_purchase_inbound_products epip (cost=0.27..8.29 rows=1 width=4) |
| Index Cond: (id = rp_1.erp_purchase_inbound_product_id) |
| -> Index Scan using tbl_erp_stores_pkey on tbl_erp_stores s_1 (cost=0.13..0.17 rows=1 width=15) |
| Index Cond: (eip_1.erp_store_id = id) |
| -> GroupAggregate (cost=2.89..19.55 rows=2 width=407) |
| Group Key: r_2.id |
| -> Nested Loop Left Join (cost=2.89..19.49 rows=2 width=75) |
| -> Nested Loop Left Join (cost=2.76..19.16 rows=2 width=68) |
| -> Merge Join (cost=2.48..2.55 rows=2 width=68) |
| Merge Cond: (r_2.id = rp_2.erp_inventory_lost_id) |
| -> Sort (cost=1.22..1.24 rows=7 width=59) |
| Sort Key: r_2.id |
| -> Seq Scan on tbl_erp_inventory_losts r_2 (cost=0.00..1.12 rows=7 width=59) |
| Filter: (status = ANY ('{1,2,5}'::integer[])) |
| -> Sort (cost=1.26..1.27 rows=3 width=13) |
| Sort Key: rp_2.erp_inventory_lost_id |
| -> Seq Scan on tbl_erp_inventory_lost_products rp_2 (cost=0.00..1.24 rows=3 width=13) |
| Filter: (product_id = 2261) |
| -> Index Scan using tbl_erp_inventory_products_pkey on tbl_erp_inventory_products eip_2 (cost=0.28..8.29 rows=1 width=8) |
| Index Cond: (id = rp_2.erp_inventory_product_id) |
| -> Index Scan using tbl_erp_stores_pkey on tbl_erp_stores s_2 (cost=0.13..0.17 rows=1 width=15) |
| Index Cond: (eip_2.erp_store_id = id) |
| -> GroupAggregate (cost=24.96..27.23 rows=10 width=401) |
| Group Key: r_3.id |
| -> Merge Left Join (cost=24.96..26.85 rows=10 width=285) |
| Merge Cond: (r_3.id = rp_3.erp_inventory_build_id) |
| Filter: ((rp_3.erp_inventory_build_id IS NOT NULL) OR (build_out.erp_inventory_build_id IS NOT NULL)) |
| -> Sort (cost=2.65..2.68 rows=10 width=129) |
| Sort Key: r_3.id |
| -> Hash Left Join (cost=1.28..2.49 rows=10 width=129) |
| Hash Cond: (r_3.id = build_out.erp_inventory_build_id) |
| -> Seq Scan on tbl_erp_inventory_builds r_3 (cost=0.00..1.17 rows=10 width=61) |
| Filter: (status = ANY ('{1,2,5}'::integer[])) |
| -> Hash (cost=1.25..1.25 rows=3 width=68) |
| -> Subquery Scan on build_out (cost=1.17..1.25 rows=3 width=68) |
| -> HashAggregate (cost=1.17..1.22 rows=3 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=3 width=14) |
| Filter: (product_id = 2261) |
| -> Materialize (cost=22.30..24.12 rows=2 width=164) |
| -> GroupAggregate (cost=22.30..24.10 rows=2 width=164) |
| Group Key: rp_3.erp_inventory_build_id |
| -> Sort (cost=22.30..22.55 rows=100 width=32) |
| Sort Key: rp_3.erp_inventory_build_id |
| -> Hash Left Join (cost=2.21..18.98 rows=100 width=32) |
| Hash Cond: (eip_3.erp_store_id = s_3.id) |
| -> Hash Right Join (cost=1.16..17.12 rows=100 width=25) |
| Hash Cond: (eip_3.erp_inventory_build_product_id = rp_3.id) |
| -> Seq Scan on tbl_erp_inventory_products eip_3 (cost=0.00..14.50 rows=550 width=25) |
| -> Hash (cost=1.14..1.14 rows=2 width=8) |
| -> Seq Scan on tbl_erp_inventory_build_products rp_3 (cost=0.00..1.14 rows=2 width=8) |
| Filter: (product_id = 2261) |
| -> Hash (cost=1.02..1.02 rows=2 width=15) |
| -> Seq Scan on tbl_erp_stores s_3 (cost=0.00..1.02 rows=2 width=15) |
| -> GroupAggregate (cost=29.94..33.87 rows=4 width=456) |
| Group Key: r_4.id |
| -> Merge Left Join (cost=29.94..33.72 rows=4 width=340) |
| Merge Cond: (r_4.id = disassemble_out.erp_inventory_disassemble_id) |
| Filter: ((rp_4.erp_inventory_disassemble_id IS NOT NULL) OR (disassemble_out.erp_inventory_disassemble_id IS NOT NULL)) |
| -> Merge Left Join (cost=28.85..32.60 rows=4 width=280) |
| Merge Cond: (r_4.id = rp_4.erp_inventory_disassemble_id) |
| -> Sort (cost=1.11..1.12 rows=4 width=116) |
| Sort Key: r_4.id |
| -> Seq Scan on tbl_erp_inventory_disassembles r_4 (cost=0.00..1.07 rows=4 width=116) |
| Filter: (status = ANY ('{1,2,5}'::integer[])) |
| -> GroupAggregate (cost=27.74..31.41 rows=3 width=164) |
| Group Key: rp_4.erp_inventory_disassemble_id |
| -> Sort (cost=27.74..28.26 rows=206 width=32) |
| Sort Key: rp_4.erp_inventory_disassemble_id |
| -> Hash Left Join (cost=2.18..19.82 rows=206 width=32) |
| Hash Cond: (eip_4.erp_store_id = s_4.id) |
| -> Hash Right Join (cost=1.14..17.09 rows=206 width=25) |
| Hash Cond: (eip_4.erp_inventory_disassemble_product_id = rp_4.id) |
| -> Seq Scan on tbl_erp_inventory_products eip_4 (cost=0.00..14.50 rows=550 width=25) |
| -> Hash (cost=1.10..1.10 rows=3 width=8) |
| -> Seq Scan on tbl_erp_inventory_disassemble_products rp_4 (cost=0.00..1.10 rows=3 width=8) |
| Filter: (product_id = 2261) |
| -> 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) |
| -> Sort (cost=1.09..1.10 rows=1 width=68) |
| Sort Key: disassemble_out.erp_inventory_disassemble_id |
| -> 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 = 2261) |
| -> GroupAggregate (cost=56.52..56.86 rows=3 width=546) |
| Group Key: r_5.id |
| -> Merge Left Join (cost=56.52..56.75 rows=3 width=486) |
| Merge Cond: (r_5.id = rp_5.erp_inventory_transfer_id) |
| Filter: ((rp_5.erp_inventory_transfer_id IS NOT NULL) OR (tbl_erp_inventory_transfer_spent_products.erp_inventory_transfer_id IS NOT NULL)) |
| -> Merge Left Join (cost=28.00..28.10 rows=3 width=330) |
| Merge Cond: (r_5.id = tbl_erp_inventory_transfer_spent_products.erp_inventory_transfer_id) |
| -> Sort (cost=12.36..12.37 rows=3 width=262) |
| Sort Key: r_5.id |
| -> Seq Scan on tbl_erp_inventory_transfers r_5 (cost=0.00..12.34 rows=3 width=262) |
| Filter: (status = ANY ('{1,2,5}'::integer[])) |
| -> GroupAggregate (cost=15.63..15.69 rows=2 width=68) |
| Group Key: tbl_erp_inventory_transfer_spent_products.erp_inventory_transfer_id |
| -> Sort (cost=15.63..15.64 rows=2 width=68) |
| Sort Key: tbl_erp_inventory_transfer_spent_products.erp_inventory_transfer_id |
| -> Seq Scan on tbl_erp_inventory_transfer_spent_products (cost=0.00..15.62 rows=2 width=68) |
| Filter: (product_id = 2261) |
| -> Materialize (cost=28.53..28.63 rows=1 width=164) |
| -> GroupAggregate (cost=28.53..28.62 rows=1 width=164) |
| Group Key: rp_5.erp_inventory_transfer_id |
| -> Sort (cost=28.53..28.54 rows=4 width=32) |
| Sort Key: rp_5.erp_inventory_transfer_id |
| -> Nested Loop Left Join (cost=12.01..28.49 rows=4 width=32) |
| -> Hash Right Join (cost=11.89..27.83 rows=4 width=25) |
| Hash Cond: (eip_5.erp_inventory_transfer_product_id = rp_5.id) |
| -> Seq Scan on tbl_erp_inventory_products eip_5 (cost=0.00..14.50 rows=550 width=25) |
| -> Hash (cost=11.88..11.88 rows=1 width=8) |
| -> Seq Scan on tbl_erp_inventory_transfer_products rp_5 (cost=0.00..11.88 rows=1 width=8) |
| Filter: (product_id = 2261) |
| -> Index Scan using tbl_erp_stores_pkey on tbl_erp_stores s_5 (cost=0.13..0.17 rows=1 width=15) |
| Index Cond: (eip_5.erp_store_id = id) |
| -> GroupAggregate (cost=20.84..21.39 rows=11 width=427) |
| Group Key: r_6.id |
| -> Sort (cost=20.84..20.86 rows=11 width=144) |
| Sort Key: r_6.id |
| -> Nested Loop Left Join (cost=3.36..20.65 rows=11 width=144) |
| Join Filter: (eip_6.erp_store_id = s_6.id) |
| -> Hash Join (cost=3.36..19.34 rows=11 width=137) |
| Hash Cond: (rp_6.erp_inventory_start_id = r_6.id) |
| -> Hash Right Join (cost=1.64..17.59 rows=11 width=58) |
| Hash Cond: (eip_6.erp_inventory_start_product_id = rp_6.id) |
| -> Seq Scan on tbl_erp_inventory_products eip_6 (cost=0.00..14.50 rows=550 width=11) |
| -> Hash (cost=1.62..1.62 rows=1 width=55) |
| -> Seq Scan on tbl_erp_inventory_start_products rp_6 (cost=0.00..1.62 rows=1 width=55) |
| Filter: (product_id = 2261) |
| -> Hash (cost=1.32..1.32 rows=32 width=83) |
| -> Seq Scan on tbl_erp_inventory_starts r_6 (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_6 (cost=0.00..1.02 rows=2 width=15) |
| -> GroupAggregate (cost=34.22..35.37 rows=20 width=457) |
| Group Key: r_7.id |
| -> Sort (cost=34.22..34.27 rows=20 width=148) |
| Sort Key: r_7.id |
| -> Nested Loop Left Join (cost=16.28..33.79 rows=20 width=148) |
| Join Filter: (eip_7.erp_store_id = s_7.id) |
| -> Nested Loop (cost=16.28..32.26 rows=20 width=141) |
| -> Hash Join (cost=16.14..27.89 rows=20 width=28) |
| Hash Cond: (rp_7.erp_inventory_product_id = eip_7.id) |
| -> Seq Scan on tbl_erp_sales_outbound_spent_products rp_7 (cost=0.00..10.34 rows=534 width=28) |
| -> Hash (cost=15.88..15.88 rows=21 width=8) |
| -> Seq Scan on tbl_erp_inventory_products eip_7 (cost=0.00..15.88 rows=21 width=8) |
| Filter: (product_id = 2261) |
| -> Index Scan using tbl_erp_sales_outbounds_pkey on tbl_erp_sales_outbounds r_7 (cost=0.14..0.22 rows=1 width=117) |
| Index Cond: (id = rp_7.erp_sales_outbound_id) |
| Filter: (status = ANY ('{1,2,5}'::integer[])) |
| -> Materialize (cost=0.00..1.03 rows=2 width=15) |
| -> Seq Scan on tbl_erp_stores s_7 (cost=0.00..1.02 rows=2 width=15) |
| -> GroupAggregate (cost=2.88..11.16 rows=1 width=481) |
| Group Key: r_8.id |
| -> Nested Loop Left Join (cost=2.88..11.12 rows=1 width=163) |
| -> Nested Loop Left Join (cost=2.75..10.93 rows=1 width=156) |
| -> Merge Join (cost=2.20..2.23 rows=1 width=156) |
| Merge Cond: (r_8.id = rp_8.erp_sales_return_id) |
| -> Sort (cost=1.11..1.12 rows=4 width=141) |
| Sort Key: r_8.id |
| -> Seq Scan on tbl_erp_sales_returns r_8 (cost=0.00..1.07 rows=4 width=141) |
| Filter: (status = ANY ('{2,5}'::integer[])) |
| -> Sort (cost=1.08..1.09 rows=2 width=19) |
| Sort Key: rp_8.erp_sales_return_id |
| -> Seq Scan on tbl_erp_sales_return_products rp_8 (cost=0.00..1.07 rows=2 width=19) |
| Filter: (product_id = 2261) |
| -> Nested Loop Left Join (cost=0.55..8.68 rows=1 width=8) |
| -> Index Scan using tbl_erp_sales_outbound_spent_products_pkey on tbl_erp_sales_outbound_spent_products rp2 (cost=0.28..8.29 rows=1 width=8) |
| Index Cond: (rp_8.erp_sales_outbound_spent_product_id = id) |
| -> Index Scan using tbl_erp_inventory_products_pkey on tbl_erp_inventory_products eip_8 (cost=0.28..0.39 rows=1 width=8) |
| Index Cond: (id = rp2.erp_inventory_product_id) |
| -> Index Scan using tbl_erp_stores_pkey on tbl_erp_stores s_8 (cost=0.13..0.17 rows=1 width=15) |
| Index Cond: (eip_8.erp_store_id = id) |
| -> GroupAggregate (cost=20.42..21.08 rows=14 width=409) |
| Group Key: r_9.id |
| -> Sort (cost=20.42..20.45 rows=14 width=97) |
| Sort Key: r_9.id |
| -> Hash Left Join (cost=4.03..20.15 rows=14 width=97) |
| Hash Cond: (eip_9.erp_store_id = s_9.id) |
| -> Hash Join (cost=2.99..18.99 rows=14 width=90) |
| Hash Cond: (rp_9.erp_purchase_gift_id = r_9.id) |
| -> Hash Right Join (cost=1.50..17.45 rows=14 width=25) |
| Hash Cond: (eip_9.erp_purchase_gift_product_id = rp_9.id) |
| -> Seq Scan on tbl_erp_inventory_products eip_9 (cost=0.00..14.50 rows=550 width=25) |
| -> Hash (cost=1.49..1.49 rows=1 width=8) |
| -> Seq Scan on tbl_erp_purchase_gift_products rp_9 (cost=0.00..1.49 rows=1 width=8) |
| Filter: (product_id = 2261) |
| -> Hash (cost=1.27..1.27 rows=17 width=69) |
| -> Seq Scan on tbl_erp_purchase_gifts r_9 (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_9 (cost=0.00..1.02 rows=2 width=15) |
| -> GroupAggregate (cost=23.15..24.71 rows=6 width=447) |
| Group Key: r_10.id |
| -> Sort (cost=23.15..23.34 rows=79 width=127) |
| Sort Key: r_10.id |
| -> Hash Left Join (cost=3.47..20.66 rows=79 width=127) |
| Hash Cond: (eip_10.erp_store_id = s_10.id) |
| -> Hash Join (cost=2.43..18.97 rows=79 width=120) |
| Hash Cond: (rp_10.erp_inventory_overflow_id = r_10.id) |
| -> Hash Right Join (cost=1.23..17.18 rows=157 width=25) |
| Hash Cond: (eip_10.erp_inventory_overflow_product_id = rp_10.id) |
| -> Seq Scan on tbl_erp_inventory_products eip_10 (cost=0.00..14.50 rows=550 width=25) |
| -> Hash (cost=1.18..1.18 rows=4 width=8) |
| -> Seq Scan on tbl_erp_inventory_overflow_products rp_10 (cost=0.00..1.18 rows=4 width=8) |
| Filter: (product_id = 2261) |
| -> Hash (cost=1.12..1.12 rows=6 width=99) |
| -> Seq Scan on tbl_erp_inventory_overflows r_10 (cost=0.00..1.12 rows=6 width=99) |
| Filter: (status = ANY ('{2,5}'::integer[])) |
| -> Hash (cost=1.02..1.02 rows=2 width=15) |
| -> Seq Scan on tbl_erp_stores s_10 (cost=0.00..1.02 rows=2 width=15) |
| -> GroupAggregate (cost=28.17..28.24 rows=2 width=436) |
| Group Key: r_11.id |
| -> Sort (cost=28.17..28.18 rows=2 width=112) |
| Sort Key: r_11.id |
| -> Nested Loop Left Join (cost=4.42..28.16 rows=2 width=112) |
| -> Nested Loop Left Join (cost=4.29..27.84 rows=2 width=105) |
| -> Hash Join (cost=4.01..11.22 rows=2 width=105) |
| Hash Cond: (r_11.id = rp_11.erp_sales_gift_id) |
| -> Seq Scan on tbl_erp_sales_gifts r_11 (cost=0.00..6.37 rows=165 width=96) |
| Filter: (status = ANY ('{1,2,5}'::integer[])) |
| -> Hash (cost=3.99..3.99 rows=2 width=13) |
| -> Seq Scan on tbl_erp_sales_gift_spent_products rp_11 (cost=0.00..3.99 rows=2 width=13) |
| Filter: (product_id = 2261) |
| -> Index Scan using tbl_erp_inventory_products_pkey on tbl_erp_inventory_products eip_11 (cost=0.28..8.29 rows=1 width=8) |
| Index Cond: (id = rp_11.erp_inventory_product_id) |
| -> Index Scan using tbl_erp_stores_pkey on tbl_erp_stores s_11 (cost=0.13..0.17 rows=1 width=15) |
| Index Cond: (eip_11.erp_store_id = id) |