| Limit (cost=41.42..41.47 rows=20 width=422) |
| -> Sort (cost=41.42..41.49 rows=26 width=422) |
| Sort Key: r.wrote_date DESC |
| -> Append (cost=20.00..40.81 rows=26 width=422) |
| -> GroupAggregate (cost=20.00..20.55 rows=10 width=427) |
| Group Key: r.id |
| Filter: (sum(eip.inventory) > '0'::numeric) |
| -> Sort (cost=20.00..20.02 rows=10 width=649) |
| Sort Key: r.id |
| -> Nested Loop Left Join (cost=4.36..19.83 rows=10 width=649) |
| Join Filter: (eip.erp_store_id = s.id) |
| -> Hash Join (cost=4.36..18.67 rows=10 width=137) |
| Hash Cond: (rp.erp_inventory_start_id = r.id) |
| -> Hash Right Join (cost=1.64..15.92 rows=10 width=58) |
| Hash Cond: (eip.erp_inventory_start_product_id = rp.id) |
| -> Seq Scan on tbl_erp_inventory_products eip (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 (cost=0.00..1.62 rows=1 width=55) |
| Filter: (product_id = 2177) |
| -> Hash (cost=2.32..2.32 rows=32 width=83) |
| -> Seq Scan on tbl_erp_inventory_starts r (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 (cost=0.00..1.01 rows=1 width=520) |
| -> GroupAggregate (cost=0.01..0.04 rows=1 width=546) |
| Group Key: id |
| -> Sort (cost=0.01..0.02 rows=0 width=786) |
| Sort Key: id |
| -> Result (cost=0.00..0.00 rows=0 width=786) |
| One-Time Filter: false |
| -> GroupAggregate (cost=19.00..19.96 rows=15 width=409) |
| Group Key: r_1.id |
| Filter: (sum(eip_1.inventory) > '0'::numeric) |
| -> Sort (cost=19.00..19.06 rows=24 width=602) |
| Sort Key: r_1.id |
| -> Nested Loop Left Join (cost=2.71..18.44 rows=24 width=602) |
| Join Filter: (eip_1.erp_store_id = s_1.id) |
| -> Hash Join (cost=2.71..17.07 rows=24 width=90) |
| Hash Cond: (rp_1.erp_purchase_gift_id = r_1.id) |
| -> Hash Right Join (cost=1.27..15.56 rows=24 width=25) |
| Hash Cond: (eip_1.erp_purchase_gift_product_id = rp_1.id) |
| -> Seq Scan on tbl_erp_inventory_products eip_1 (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_1 (cost=0.00..1.26 rows=1 width=8) |
| Filter: (product_id = 2177) |
| -> Hash (cost=1.25..1.25 rows=15 width=69) |
| -> Seq Scan on tbl_erp_purchase_gifts r_1 (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_1 (cost=0.00..1.01 rows=1 width=520) |