                                                                                         QUERY PLAN                                                                                          
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=1217431.33..1217434.64 rows=100 width=160)
   ->  GroupAggregate  (cost=1217431.33..1217444.61 rows=401 width=160)
         Group Key: ('store channel'::text), (('store'::text || (ssr.store_id)::text))
         Group Key: ('store channel'::text)
         Group Key: ()
         ->  Sort  (cost=1217431.33..1217432.37 rows=418 width=160)
               Sort Key: ('store channel'::text), (('store'::text || (ssr.store_id)::text))
               ->  Append  (cost=895587.78..1217413.13 rows=418 width=160)
                     ->  Subquery Scan on ssr  (cost=895587.78..895598.60 rows=51 width=160)
                           ->  GroupAggregate  (cost=895587.78..895597.83 rows=51 width=113)
                                 Group Key: store.s_store_id
                                 ->  Sort  (cost=895587.78..895589.30 rows=611 width=41)
                                       Sort Key: store.s_store_id
                                       ->  Nested Loop Left Join  (cost=2509.45..895559.50 rows=611 width=41)
                                             ->  Nested Loop  (cost=2509.02..894787.50 rows=611 width=37)
                                                   ->  Nested Loop  (cost=2508.72..883663.82 rows=11148 width=37)
                                                         ->  Hash Join  (cost=2508.44..883067.04 rows=11871 width=41)
                                                               Hash Cond: (store_sales.ss_store_sk = store.s_store_sk)
                                                               ->  Hash Join  (cost=2501.15..883025.85 rows=12419 width=28)
                                                                     Hash Cond: (store_sales.ss_sold_date_sk = date_dim.d_date_sk)
                                                                     ->  Seq Scan on store_sales  (cost=0.00..804917.92 rows=28800992 width=32)
                                                                     ->  Hash  (cost=2500.73..2500.73 rows=33 width=4)
                                                                           ->  Seq Scan on date_dim  (cost=0.00..2500.73 rows=33 width=4)
                                                                                 Filter: ((d_date >= '2002-08-04'::date) AND (d_date <= '2002-09-03 00:00:00'::timestamp without time zone))
                                                               ->  Hash  (cost=6.02..6.02 rows=102 width=21)
                                                                     ->  Seq Scan on store  (cost=0.00..6.02 rows=102 width=21)
                                                         ->  Result Cache  (cost=0.28..0.61 rows=1 width=4)
                                                               Cache Key: store_sales.ss_promo_sk
                                                               ->  Index Scan using promotion_pkey on promotion  (cost=0.27..0.60 rows=1 width=4)
                                                                     Index Cond: (p_promo_sk = store_sales.ss_promo_sk)
                                                                     Filter: (p_channel_tv = 'N'::bpchar)
                                                   ->  Index Scan using item_pkey on item  (cost=0.29..1.00 rows=1 width=4)
                                                         Index Cond: (i_item_sk = store_sales.ss_item_sk)
                                                         Filter: (i_current_price > '50'::numeric)
                                             ->  Index Scan using store_returns_pkey on store_returns  (cost=0.43..1.26 rows=1 width=20)
                                                   Index Cond: ((sr_item_sk = store_sales.ss_item_sk) AND (sr_ticket_number = store_sales.ss_ticket_number))
                     ->  Subquery Scan on csr  (cost=39497.96..39514.40 rows=346 width=160)
                           ->  GroupAggregate  (cost=39497.96..39509.21 rows=346 width=113)
                                 Group Key: catalog_page.cp_catalog_page_id
                                 ->  Sort  (cost=39497.96..39498.83 rows=346 width=41)
                                       Sort Key: catalog_page.cp_catalog_page_id
                                       ->  Nested Loop Left Join  (cost=1.71..39483.37 rows=346 width=41)
                                             ->  Nested Loop  (cost=1.29..39325.30 rows=346 width=37)
                                                   ->  Nested Loop  (cost=1.00..39220.00 rows=348 width=24)
                                                         ->  Nested Loop  (cost=0.73..39116.18 rows=355 width=28)
                                                               ->  Nested Loop  (cost=0.43..37080.66 rows=6472 width=28)
                                                                     ->  Seq Scan on date_dim date_dim_1  (cost=0.00..2500.73 rows=33 width=4)
                                                                           Filter: ((d_date >= '2002-08-04'::date) AND (d_date <= '2002-09-03 00:00:00'::timestamp without time zone))
                                                                     ->  Index Scan using catalog_sales_cs_sold_date_sk_idx on catalog_sales  (cost=0.43..969.76 rows=7812 width=32)
                                                                           Index Cond: (cs_sold_date_sk = date_dim_1.d_date_sk)
                                                               ->  Index Scan using item_pkey on item item_1  (cost=0.29..0.31 rows=1 width=4)
                                                                     Index Cond: (i_item_sk = catalog_sales.cs_item_sk)
                                                                     Filter: (i_current_price > '50'::numeric)
                                                         ->  Index Scan using promotion_pkey on promotion promotion_1  (cost=0.27..0.29 rows=1 width=4)
                                                               Index Cond: (p_promo_sk = catalog_sales.cs_promo_sk)
                                                               Filter: (p_channel_tv = 'N'::bpchar)
                                                   ->  Index Scan using catalog_page_pkey on catalog_page  (cost=0.29..0.30 rows=1 width=21)
                                                         Index Cond: (cp_catalog_page_sk = catalog_sales.cs_catalog_page_sk)
                                             ->  Index Scan using catalog_returns_pkey on catalog_returns  (cost=0.43..0.46 rows=1 width=20)
                                                   Index Cond: ((cr_item_sk = catalog_sales.cs_item_sk) AND (cr_order_number = catalog_sales.cs_order_number))
                     ->  Subquery Scan on wsr  (cost=282294.73..282298.04 rows=21 width=160)
                           ->  GroupAggregate  (cost=282294.73..282297.73 rows=21 width=113)
                                 Group Key: web_site.web_site_id
                                 ->  Sort  (cost=282294.73..282295.17 rows=175 width=41)
                                       Sort Key: web_site.web_site_id
                                       ->  Hash Join  (cost=2506.08..282288.21 rows=175 width=41)
                                             Hash Cond: (web_sales.ws_web_site_sk = web_site.web_site_sk)
                                             ->  Nested Loop Left Join  (cost=2502.14..282283.77 rows=175 width=28)
                                                   ->  Nested Loop  (cost=2501.71..282204.36 rows=175 width=24)
                                                         ->  Nested Loop  (cost=2501.44..282152.30 rows=178 width=28)
                                                               ->  Hash Join  (cost=2501.15..281123.59 rows=3250 width=28)
                                                                     Hash Cond: (web_sales.ws_sold_date_sk = date_dim_2.d_date_sk)
                                                                     ->  Seq Scan on web_sales  (cost=0.00..259726.89 rows=7197889 width=32)
                                                                     ->  Hash  (cost=2500.73..2500.73 rows=33 width=4)
                                                                           ->  Seq Scan on date_dim date_dim_2  (cost=0.00..2500.73 rows=33 width=4)
                                                                                 Filter: ((d_date >= '2002-08-04'::date) AND (d_date <= '2002-09-03 00:00:00'::timestamp without time zone))
                                                               ->  Index Scan using item_pkey on item item_2  (cost=0.29..0.32 rows=1 width=4)
                                                                     Index Cond: (i_item_sk = web_sales.ws_item_sk)
                                                                     Filter: (i_current_price > '50'::numeric)
                                                         ->  Index Scan using promotion_pkey on promotion promotion_2  (cost=0.27..0.29 rows=1 width=4)
                                                               Index Cond: (p_promo_sk = web_sales.ws_promo_sk)
                                                               Filter: (p_channel_tv = 'N'::bpchar)
                                                   ->  Index Scan using web_returns_pkey on web_returns  (cost=0.42..0.45 rows=1 width=20)
                                                         Index Cond: ((wr_item_sk = web_sales.ws_item_sk) AND (wr_order_number = web_sales.ws_order_number))
                                             ->  Hash  (cost=3.42..3.42 rows=42 width=21)
                                                   ->  Seq Scan on web_site  (cost=0.00..3.42 rows=42 width=21)
(86 rows)

