| Limit (cost=117.61..117.66 rows=19 width=423) |
| -> Sort (cost=117.61..117.66 rows=19 width=423) |
| Sort Key: r.wrote_date DESC |
| -> Append (cost=2.87..117.21 rows=19 width=423) |
| -> GroupAggregate (cost=2.87..11.04 rows=1 width=407) |
| Group Key: r.id |
| -> Nested Loop Left Join (cost=2.87..11.01 rows=1 width=75) |
| -> Merge Join (cost=2.47..2.52 rows=1 width=68) |
| Merge Cond: (r.id = rp.erp_inventory_lost_id) |
| -> Sort (cost=1.22..1.24 rows=7 width=59) |
| Sort Key: r.id |
| -> Seq Scan on tbl_erp_inventory_losts r (cost=0.00..1.12 rows=7 width=59) |
| Filter: (status = ANY ('{1,2,5}'::integer[])) |
| -> Sort (cost=1.25..1.25 rows=1 width=13) |
| Sort Key: rp.erp_inventory_lost_id |
| -> Seq Scan on tbl_erp_inventory_lost_products rp (cost=0.00..1.24 rows=1 width=13) |
| Filter: (product_id = 1372) |
| -> Nested Loop Left Join (cost=0.40..8.49 rows=1 width=15) |
| -> Index Scan using tbl_erp_inventory_products_pkey on tbl_erp_inventory_products eip (cost=0.28..8.29 rows=1 width=8) |
| Index Cond: (id = rp.erp_inventory_product_id) |
| -> 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=22.20..23.51 rows=10 width=401) |
| Group Key: r_1.id |
| -> Merge Left Join (cost=22.20..23.13 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 = 1372) |
| -> Materialize (cost=19.63..20.51 rows=1 width=164) |
| -> GroupAggregate (cost=19.63..20.49 rows=1 width=164) |
| Group Key: rp_1.erp_inventory_build_id |
| -> Sort (cost=19.63..19.75 rows=48 width=32) |
| Sort Key: rp_1.erp_inventory_build_id |
| -> Hash Left Join (cost=2.19..18.29 rows=48 width=32) |
| Hash Cond: (eip_1.erp_store_id = s_1.id) |
| -> Hash Right Join (cost=1.15..16.85 rows=48 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..14.31 rows=531 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 = 1372) |
| -> 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=22.62..23.99 rows=4 width=456) |
| Group Key: r_2.id |
| -> Merge Left Join (cost=22.62..23.84 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 = 1372) |
| -> Materialize (cost=20.40..21.59 rows=1 width=164) |
| -> GroupAggregate (cost=20.40..21.57 rows=1 width=164) |
| Group Key: rp_2.erp_inventory_disassemble_id |
| -> Sort (cost=20.40..20.56 rows=66 width=32) |
| Sort Key: rp_2.erp_inventory_disassemble_id |
| -> Hash Left Join (cost=2.16..18.40 rows=66 width=32) |
| Hash Cond: (eip_2.erp_store_id = s_2.id) |
| -> Hash Right Join (cost=1.11..16.82 rows=66 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..14.31 rows=531 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 = 1372) |
| -> 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=38.76..38.93 rows=3 width=457) |
| Group Key: r_3.id |
| -> Sort (cost=38.76..38.77 rows=3 width=148) |
| Sort Key: r_3.id |
| -> Nested Loop Left Join (cost=20.71..38.74 rows=3 width=148) |
| -> Hash Right Join (cost=20.58..38.24 rows=3 width=141) |
| Hash Cond: (eip_3.id = rp_3.erp_inventory_product_id) |
| -> Seq Scan on tbl_erp_inventory_products eip_3 (cost=0.00..14.31 rows=531 width=8) |
| -> Hash (cost=20.55..20.55 rows=3 width=141) |
| -> Hash Join (cost=11.71..20.55 rows=3 width=141) |
| Hash Cond: (r_3.id = rp_3.erp_sales_outbound_id) |
| -> Seq Scan on tbl_erp_sales_outbounds r_3 (cost=0.00..7.64 rows=186 width=117) |
| Filter: (status = ANY ('{1,2,5}'::integer[])) |
| -> Hash (cost=11.68..11.68 rows=3 width=28) |
| -> Seq Scan on tbl_erp_sales_outbound_spent_products rp_3 (cost=0.00..11.68 rows=3 width=28) |
| Filter: (product_id = 1372) |
| -> Index Scan using tbl_erp_stores_pkey on tbl_erp_stores s_3 (cost=0.13..0.17 rows=1 width=15) |
| Index Cond: (eip_3.erp_store_id = id) |
| -> GroupAggregate (cost=19.50..19.54 rows=1 width=436) |
| Group Key: r_4.id |
| -> Sort (cost=19.50..19.51 rows=1 width=112) |
| Sort Key: r_4.id |
| -> Nested Loop Left Join (cost=4.40..19.49 rows=1 width=112) |
| -> Hash Join (cost=4.00..10.99 rows=1 width=105) |
| Hash Cond: (r_4.id = rp_4.erp_sales_gift_id) |
| -> Seq Scan on tbl_erp_sales_gifts r_4 (cost=0.00..6.37 rows=165 width=96) |
| Filter: (status = ANY ('{1,2,5}'::integer[])) |
| -> Hash (cost=3.99..3.99 rows=1 width=13) |
| -> Seq Scan on tbl_erp_sales_gift_spent_products rp_4 (cost=0.00..3.99 rows=1 width=13) |
| Filter: (product_id = 1372) |
| -> Nested Loop Left Join (cost=0.40..8.49 rows=1 width=15) |
| -> Index Scan using tbl_erp_inventory_products_pkey on tbl_erp_inventory_products eip_4 (cost=0.28..8.29 rows=1 width=8) |
| Index Cond: (id = rp_4.erp_inventory_product_id) |
| -> Index Scan using tbl_erp_stores_pkey on tbl_erp_stores s_4 (cost=0.13..0.17 rows=1 width=15) |
| Index Cond: (eip_4.erp_store_id = id) |