| Limit (cost=289.24..289.29 rows=20 width=447) |
| -> Sort (cost=289.24..289.34 rows=39 width=447) |
| Sort Key: r.wrote_date DESC |
| -> Append (cost=35.11..288.21 rows=39 width=447) |
| -> GroupAggregate (cost=35.11..35.16 rows=1 width=407) |
| Group Key: r.id |
| -> 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 = 2080) |
| -> 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=10.47..24.91 rows=1 width=546) |
| Group Key: r_1.id |
| -> Nested Loop Left Join (cost=10.47..24.88 rows=1 width=786) |
| -> Nested Loop Left Join (cost=10.35..24.67 rows=1 width=274) |
| -> Merge Join (cost=2.04..2.07 rows=1 width=274) |
| Merge Cond: (r_1.id = rp_1.erp_purchase_return_id) |
| -> Sort (cost=1.02..1.03 rows=1 width=206) |
| Sort Key: r_1.id |
| -> Seq Scan on tbl_erp_purchase_returns r_1 (cost=0.00..1.01 rows=1 width=206) |
| Filter: (status = ANY ('{2,5}'::integer[])) |
| -> Sort (cost=1.02..1.03 rows=1 width=72) |
| Sort Key: rp_1.erp_purchase_return_id |
| -> Seq Scan on tbl_erp_purchase_return_products rp_1 (cost=0.00..1.01 rows=1 width=72) |
| Filter: (product_id = 2080) |
| -> Hash Right Join (cost=8.30..22.59 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..12.97 rows=497 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.12..0.17 rows=1 width=520) |
| Index Cond: (eip_1.erp_store_id = id) |
| -> GroupAggregate (cost=2.64..10.81 rows=1 width=546) |
| Group Key: r_2.id |
| -> Nested Loop Left Join (cost=2.64..10.78 rows=1 width=746) |
| -> Merge Join (cost=2.24..2.27 rows=1 width=234) |
| Merge Cond: (r_2.id = rp_2.erp_inventory_lost_id) |
| -> Sort (cost=1.07..1.07 rows=3 width=198) |
| Sort Key: r_2.id |
| -> Seq Scan on tbl_erp_inventory_losts r_2 (cost=0.00..1.04 rows=3 width=198) |
| Filter: (status = ANY ('{1,2,5}'::integer[])) |
| -> Sort (cost=1.17..1.18 rows=1 width=40) |
| Sort Key: rp_2.erp_inventory_lost_id |
| -> Seq Scan on tbl_erp_inventory_lost_products rp_2 (cost=0.00..1.16 rows=1 width=40) |
| Filter: (product_id = 2080) |
| -> Nested Loop Left Join (cost=0.40..8.50 rows=1 width=520) |
| -> Index Scan using tbl_erp_inventory_products_pkey on tbl_erp_inventory_products eip_2 (cost=0.27..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.12..0.17 rows=1 width=520) |
| Index Cond: (eip_2.erp_store_id = id) |
| -> GroupAggregate (cost=30.31..34.84 rows=2 width=546) |
| Group Key: r_3.id |
| -> Nested Loop Left Join (cost=30.31..34.76 rows=2 width=486) |
| Join Filter: (build_out.erp_inventory_build_id = r_3.id) |
| Filter: ((rp_3.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_3.id = rp_3.erp_inventory_build_id) |
| -> Sort (cost=1.04..1.04 rows=2 width=262) |
| Sort Key: r_3.id |
| -> Seq Scan on tbl_erp_inventory_builds r_3 (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_3.erp_inventory_build_id |
| -> Sort (cost=28.24..28.86 rows=248 width=537) |
| Sort Key: rp_3.erp_inventory_build_id |
| -> Hash Left Join (cost=2.06..18.38 rows=248 width=537) |
| Hash Cond: (eip_3.erp_store_id = s_3.id) |
| -> Hash Right Join (cost=1.04..15.32 rows=248 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..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_3 (cost=0.00..1.02 rows=1 width=8) |
| Filter: (product_id = 2080) |
| -> Hash (cost=1.01..1.01 rows=1 width=520) |
| -> Seq Scan on tbl_erp_stores s_3 (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 = 2080) |
| -> GroupAggregate (cost=55.52..55.83 rows=3 width=546) |
| Group Key: r_4.id |
| -> Merge Left Join (cost=55.52..55.71 rows=3 width=486) |
| Merge Cond: (r_4.id = rp_4.erp_inventory_disassemble_id) |
| Filter: ((rp_4.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_4.id = tbl_erp_inventory_disassemble_spent_products.erp_inventory_disassemble_id) |
| -> Sort (cost=12.50..12.51 rows=3 width=262) |
| Sort Key: r_4.id |
| -> Seq Scan on tbl_erp_inventory_disassembles r_4 (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 = 2080) |
| -> Materialize (cost=27.14..27.21 rows=1 width=164) |
| -> GroupAggregate (cost=27.14..27.20 rows=1 width=164) |
| Group Key: rp_4.erp_inventory_disassemble_id |
| -> Sort (cost=27.14..27.15 rows=2 width=537) |
| Sort Key: rp_4.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_4.erp_inventory_disassemble_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=12.50..12.50 rows=1 width=8) |
| -> Seq Scan on tbl_erp_inventory_disassemble_products rp_4 (cost=0.00..12.50 rows=1 width=8) |
| Filter: (product_id = 2080) |
| -> Index Scan using tbl_erp_stores_pkey on tbl_erp_stores s_4 (cost=0.12..0.17 rows=1 width=520) |
| Index Cond: (eip_4.erp_store_id = id) |
| -> GroupAggregate (cost=20.00..20.50 rows=10 width=427) |
| Group Key: r_5.id |
| -> Sort (cost=20.00..20.02 rows=10 width=649) |
| Sort Key: r_5.id |
| -> Nested Loop Left Join (cost=4.36..19.83 rows=10 width=649) |
| Join Filter: (eip_5.erp_store_id = s_5.id) |
| -> Hash Join (cost=4.36..18.67 rows=10 width=137) |
| Hash Cond: (rp_5.erp_inventory_start_id = r_5.id) |
| -> Hash Right Join (cost=1.64..15.92 rows=10 width=58) |
| Hash Cond: (eip_5.erp_inventory_start_product_id = rp_5.id) |
| -> Seq Scan on tbl_erp_inventory_products eip_5 (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_5 (cost=0.00..1.62 rows=1 width=55) |
| Filter: (product_id = 2080) |
| -> Hash (cost=2.32..2.32 rows=32 width=83) |
| -> Seq Scan on tbl_erp_inventory_starts r_5 (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_5 (cost=0.00..1.01 rows=1 width=520) |
| -> GroupAggregate (cost=25.93..25.99 rows=1 width=455) |
| Group Key: r_6.id |
| -> Sort (cost=25.93..25.94 rows=1 width=651) |
| Sort Key: r_6.id |
| -> Nested Loop (cost=0.54..25.92 rows=1 width=651) |
| -> Nested Loop Left Join (cost=0.40..17.65 rows=1 width=540) |
| -> Seq Scan on tbl_erp_sales_outbound_spent_products rp_6 (cost=0.00..9.14 rows=1 width=28) |
| Filter: (product_id = 2080) |
| -> Nested Loop Left Join (cost=0.40..8.50 rows=1 width=520) |
| -> Index Scan using tbl_erp_inventory_products_pkey on tbl_erp_inventory_products eip_6 (cost=0.27..8.29 rows=1 width=8) |
| Index Cond: (id = rp_6.erp_inventory_product_id) |
| -> Index Scan using tbl_erp_stores_pkey on tbl_erp_stores s_6 (cost=0.12..0.17 rows=1 width=520) |
| Index Cond: (eip_6.erp_store_id = id) |
| -> Index Scan using tbl_erp_sales_outbounds_pkey on tbl_erp_sales_outbounds r_6 (cost=0.14..8.17 rows=1 width=115) |
| Index Cond: (id = rp_6.erp_sales_outbound_id) |
| Filter: (status = ANY ('{1,2,5}'::integer[])) |
| -> GroupAggregate (cost=2.71..11.03 rows=1 width=546) |
| Group Key: r_7.id |
| -> Nested Loop Left Join (cost=2.71..10.99 rows=1 width=786) |
| -> Nested Loop Left Join (cost=2.59..10.78 rows=1 width=274) |
| -> Merge Join (cost=2.04..2.07 rows=1 width=274) |
| Merge Cond: (r_7.id = rp_7.erp_sales_return_id) |
| -> Sort (cost=1.02..1.03 rows=1 width=206) |
| Sort Key: r_7.id |
| -> Seq Scan on tbl_erp_sales_returns r_7 (cost=0.00..1.01 rows=1 width=206) |
| Filter: (status = ANY ('{2,5}'::integer[])) |
| -> Sort (cost=1.02..1.03 rows=1 width=72) |
| Sort Key: rp_7.erp_sales_return_id |
| -> Seq Scan on tbl_erp_sales_return_products rp_7 (cost=0.00..1.01 rows=1 width=72) |
| Filter: (product_id = 2080) |
| -> Nested Loop Left Join (cost=0.55..8.70 rows=1 width=8) |
| -> Index Scan using tbl_erp_sales_outbound_spent_products_pkey on tbl_erp_sales_outbound_spent_products rp2 (cost=0.27..8.29 rows=1 width=8) |
| Index Cond: (rp_7.erp_sales_outbound_spent_product_id = id) |
| -> Index Scan using tbl_erp_inventory_products_pkey on tbl_erp_inventory_products eip_7 (cost=0.27..0.41 rows=1 width=8) |
| Index Cond: (id = rp2.erp_inventory_product_id) |
| -> Index Scan using tbl_erp_stores_pkey on tbl_erp_stores s_7 (cost=0.12..0.17 rows=1 width=520) |
| Index Cond: (eip_7.erp_store_id = id) |
| -> GroupAggregate (cost=19.00..19.87 rows=15 width=409) |
| Group Key: r_8.id |
| -> Sort (cost=19.00..19.06 rows=24 width=602) |
| Sort Key: r_8.id |
| -> Nested Loop Left Join (cost=2.71..18.44 rows=24 width=602) |
| Join Filter: (eip_8.erp_store_id = s_8.id) |
| -> Hash Join (cost=2.71..17.07 rows=24 width=90) |
| Hash Cond: (rp_8.erp_purchase_gift_id = r_8.id) |
| -> Hash Right Join (cost=1.27..15.56 rows=24 width=25) |
| Hash Cond: (eip_8.erp_purchase_gift_product_id = rp_8.id) |
| -> Seq Scan on tbl_erp_inventory_products eip_8 (cost=0.00..12.97 rows=497 width=25) |
| -> Hash (cost=1.26..1.26 rows=1 width=8) |
| -> Seq Scan on tbl_erp_purchase_gift_products rp_8 (cost=0.00..1.26 rows=1 width=8) |
| Filter: (product_id = 2080) |
| -> Hash (cost=1.25..1.25 rows=15 width=69) |
| -> Seq Scan on tbl_erp_purchase_gifts r_8 (cost=0.00..1.25 rows=15 width=69) |
| Filter: (status = ANY ('{2,5}'::integer[])) |
| -> Materialize (cost=0.00..1.01 rows=1 width=520) |
| -> Seq Scan on tbl_erp_stores s_8 (cost=0.00..1.01 rows=1 width=520) |
| -> GroupAggregate (cost=27.62..28.19 rows=3 width=451) |
| Group Key: r_9.id |
| -> 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_9.erp_inventory_overflow_id = r_9.id) |
| -> Sort (cost=26.33..26.34 rows=3 width=25) |
| Sort Key: rp_9.erp_inventory_overflow_id |
| -> Hash Right Join (cost=12.01..26.31 rows=3 width=25) |
| Hash Cond: (eip_9.erp_inventory_overflow_product_id = rp_9.id) |
| -> Seq Scan on tbl_erp_inventory_products eip_9 (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_9 (cost=0.00..12.00 rows=1 width=8) |
| Filter: (product_id = 2080) |
| -> Sort (cost=1.16..1.17 rows=5 width=103) |
| Sort Key: r_9.id |
| -> Seq Scan on tbl_erp_inventory_overflows r_9 (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_9 (cost=0.12..0.17 rows=1 width=520) |
| Index Cond: (eip_9.erp_store_id = id) |
| -> GroupAggregate (cost=20.67..20.71 rows=1 width=436) |
| Group Key: r_10.id |
| -> Sort (cost=20.67..20.68 rows=1 width=617) |
| Sort Key: r_10.id |
| -> Nested Loop (cost=0.54..20.66 rows=1 width=617) |
| -> Nested Loop Left Join (cost=0.40..12.37 rows=1 width=525) |
| -> Seq Scan on tbl_erp_sales_gift_spent_products rp_10 (cost=0.00..3.86 rows=1 width=13) |
| Filter: (product_id = 2080) |
| -> Nested Loop Left Join (cost=0.40..8.50 rows=1 width=520) |
| -> Index Scan using tbl_erp_inventory_products_pkey on tbl_erp_inventory_products eip_10 (cost=0.27..8.29 rows=1 width=8) |
| Index Cond: (id = rp_10.erp_inventory_product_id) |
| -> Index Scan using tbl_erp_stores_pkey on tbl_erp_stores s_10 (cost=0.12..0.17 rows=1 width=520) |
| Index Cond: (eip_10.erp_store_id = id) |
| -> Index Scan using tbl_erp_sales_gifts_pkey on tbl_erp_sales_gifts r_10 (cost=0.14..8.16 rows=1 width=96) |
| Index Cond: (id = rp_10.erp_sales_gift_id) |
| Filter: (status = ANY ('{1,2,5}'::integer[])) |