                                                                                                             QUERY PLAN                                                                                                             
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=1217431.33..1217434.64 rows=100 width=160) (actual time=20259.250..20259.619 rows=100 loops=1)
   Buffers: shared hit=4216588
   ->  GroupAggregate  (cost=1217431.33..1217444.61 rows=401 width=160) (actual time=20259.248..20259.601 rows=100 loops=1)
         Group Key: ('store channel'::text), (('store'::text || (ssr.store_id)::text))
         Group Key: ('store channel'::text)
         Group Key: ()
         Buffers: shared hit=4216588
         ->  Sort  (cost=1217431.33..1217432.37 rows=418 width=160) (actual time=20259.235..20259.266 rows=101 loops=1)
               Sort Key: ('store channel'::text), (('store'::text || (ssr.store_id)::text))
               Sort Method: quicksort  Memory: 95kB
               Buffers: shared hit=4216588
               ->  Append  (cost=895587.78..1217413.13 rows=418 width=160) (actual time=14414.375..20256.403 rows=504 loops=1)
                     Buffers: shared hit=4216585
                     ->  Subquery Scan on ssr  (cost=895587.78..895598.60 rows=51 width=160) (actual time=14414.374..14442.155 rows=51 loops=1)
                           Buffers: shared hit=2368382
                           ->  GroupAggregate  (cost=895587.78..895597.83 rows=51 width=113) (actual time=14414.368..14442.109 rows=51 loops=1)
                                 Group Key: store.s_store_id
                                 Buffers: shared hit=2368382
                                 ->  Sort  (cost=895587.78..895589.30 rows=611 width=41) (actual time=14413.853..14416.699 rows=32221 loops=1)
                                       Sort Key: store.s_store_id
                                       Sort Method: quicksort  Memory: 3286kB
                                       Buffers: shared hit=2368382
                                       ->  Nested Loop Left Join  (cost=2509.45..895559.50 rows=611 width=41) (actual time=18.826..14362.137 rows=32221 loops=1)
                                             Buffers: shared hit=2368379
                                             ->  Nested Loop  (cost=2509.02..894787.50 rows=611 width=37) (actual time=18.805..14155.525 rows=32221 loops=1)
                                                   Buffers: shared hit=2268569
                                                   ->  Nested Loop  (cost=2508.72..883663.82 rows=11148 width=37) (actual time=18.136..11472.534 rows=582917 loops=1)
                                                         Buffers: shared hit=519818
                                                         ->  Hash Join  (cost=2508.44..883067.04 rows=11871 width=41) (actual time=18.112..10939.175 rows=599425 loops=1)
                                                               Hash Cond: (store_sales.ss_store_sk = store.s_store_sk)
                                                               Buffers: shared hit=518318
                                                               ->  Hash Join  (cost=2501.15..883025.85 rows=12419 width=28) (actual time=18.000..10653.420 rows=613805 loops=1)
                                                                     Hash Cond: (store_sales.ss_sold_date_sk = date_dim.d_date_sk)
                                                                     Buffers: shared hit=518313
                                                                     ->  Seq Scan on store_sales  (cost=0.00..804917.92 rows=28800992 width=32) (actual time=0.005..3890.106 rows=28800991 loops=1)
                                                                           Buffers: shared hit=516908
                                                                     ->  Hash  (cost=2500.73..2500.73 rows=33 width=4) (actual time=17.934..17.936 rows=31 loops=1)
                                                                           Buckets: 1024  Batches: 1  Memory Usage: 10kB
                                                                           Buffers: shared hit=1405
                                                                           ->  Seq Scan on date_dim  (cost=0.00..2500.73 rows=33 width=4) (actual time=8.972..17.923 rows=31 loops=1)
                                                                                 Filter: ((d_date >= '2002-08-04'::date) AND (d_date <= '2002-09-03 00:00:00'::timestamp without time zone))
                                                                                 Rows Removed by Filter: 73018
                                                                                 Buffers: shared hit=1405
                                                               ->  Hash  (cost=6.02..6.02 rows=102 width=21) (actual time=0.099..0.100 rows=102 loops=1)
                                                                     Buckets: 1024  Batches: 1  Memory Usage: 14kB
                                                                     Buffers: shared hit=5
                                                                     ->  Seq Scan on store  (cost=0.00..6.02 rows=102 width=21) (actual time=0.008..0.059 rows=102 loops=1)
                                                                           Buffers: shared hit=5
                                                         ->  Result Cache  (cost=0.28..0.61 rows=1 width=4) (actual time=0.000..0.000 rows=1 loops=599425)
                                                               Cache Key: store_sales.ss_promo_sk
                                                               Hits: 598924  Misses: 501  Evictions: 0  Overflows: 0  Memory Usage: 51kB
                                                               Buffers: shared hit=1500
                                                               ->  Index Scan using promotion_pkey on promotion  (cost=0.27..0.60 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=501)
                                                                     Index Cond: (p_promo_sk = store_sales.ss_promo_sk)
                                                                     Filter: (p_channel_tv = 'N'::bpchar)
                                                                     Rows Removed by Filter: 0
                                                                     Buffers: shared hit=1500
                                                   ->  Index Scan using item_pkey on item  (cost=0.29..1.00 rows=1 width=4) (actual time=0.004..0.004 rows=0 loops=582917)
                                                         Index Cond: (i_item_sk = store_sales.ss_item_sk)
                                                         Filter: (i_current_price > '50'::numeric)
                                                         Rows Removed by Filter: 1
                                                         Buffers: shared hit=1748751
                                             ->  Index Scan using store_returns_pkey on store_returns  (cost=0.43..1.26 rows=1 width=20) (actual time=0.006..0.006 rows=0 loops=32221)
                                                   Index Cond: ((sr_item_sk = store_sales.ss_item_sk) AND (sr_ticket_number = store_sales.ss_ticket_number))
                                                   Buffers: shared hit=99810
                     ->  Subquery Scan on csr  (cost=39497.96..39514.40 rows=346 width=160) (actual time=1937.212..1953.758 rows=432 loops=1)
                           Buffers: shared hit=1130308
                           ->  GroupAggregate  (cost=39497.96..39509.21 rows=346 width=113) (actual time=1937.206..1953.439 rows=432 loops=1)
                                 Group Key: catalog_page.cp_catalog_page_id
                                 Buffers: shared hit=1130308
                                 ->  Sort  (cost=39497.96..39498.83 rows=346 width=41) (actual time=1937.117..1938.703 rows=17422 loops=1)
                                       Sort Key: catalog_page.cp_catalog_page_id
                                       Sort Method: quicksort  Memory: 2131kB
                                       Buffers: shared hit=1130308
                                       ->  Nested Loop Left Join  (cost=1.71..39483.37 rows=346 width=41) (actual time=7.522..1897.407 rows=17422 loops=1)
                                             Buffers: shared hit=1130308
                                             ->  Nested Loop  (cost=1.29..39325.30 rows=346 width=37) (actual time=7.499..1802.260 rows=17422 loops=1)
                                                   Buffers: shared hit=1076253
                                                   ->  Nested Loop  (cost=1.00..39220.00 rows=348 width=24) (actual time=7.484..1739.899 rows=17448 loops=1)
                                                         Buffers: shared hit=1023987
                                                         ->  Nested Loop  (cost=0.73..39116.18 rows=355 width=28) (actual time=7.472..1675.975 rows=17779 loops=1)
                                                               Buffers: shared hit=970779
                                                               ->  Nested Loop  (cost=0.43..37080.66 rows=6472 width=28) (actual time=7.182..337.869 rows=320131 loops=1)
                                                                     Buffers: shared hit=10386
                                                                     ->  Seq Scan on date_dim date_dim_1  (cost=0.00..2500.73 rows=33 width=4) (actual time=7.128..15.220 rows=31 loops=1)
                                                                           Filter: ((d_date >= '2002-08-04'::date) AND (d_date <= '2002-09-03 00:00:00'::timestamp without time zone))
                                                                           Rows Removed by Filter: 73018
                                                                           Buffers: shared hit=1405
                                                                     ->  Index Scan using catalog_sales_cs_sold_date_sk_idx on catalog_sales  (cost=0.43..969.76 rows=7812 width=32) (actual time=0.018..4.782 rows=10327 loops=31)
                                                                           Index Cond: (cs_sold_date_sk = date_dim_1.d_date_sk)
                                                                           Buffers: shared hit=8981
                                                               ->  Index Scan using item_pkey on item item_1  (cost=0.29..0.31 rows=1 width=4) (actual time=0.004..0.004 rows=0 loops=320131)
                                                                     Index Cond: (i_item_sk = catalog_sales.cs_item_sk)
                                                                     Filter: (i_current_price > '50'::numeric)
                                                                     Rows Removed by Filter: 1
                                                                     Buffers: shared hit=960393
                                                         ->  Index Scan using promotion_pkey on promotion promotion_1  (cost=0.27..0.29 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=17779)
                                                               Index Cond: (p_promo_sk = catalog_sales.cs_promo_sk)
                                                               Filter: (p_channel_tv = 'N'::bpchar)
                                                               Rows Removed by Filter: 0
                                                               Buffers: shared hit=53208
                                                   ->  Index Scan using catalog_page_pkey on catalog_page  (cost=0.29..0.30 rows=1 width=21) (actual time=0.003..0.003 rows=1 loops=17448)
                                                         Index Cond: (cp_catalog_page_sk = catalog_sales.cs_catalog_page_sk)
                                                         Buffers: shared hit=52266
                                             ->  Index Scan using catalog_returns_pkey on catalog_returns  (cost=0.43..0.46 rows=1 width=20) (actual time=0.005..0.005 rows=0 loops=17422)
                                                   Index Cond: ((cr_item_sk = catalog_sales.cs_item_sk) AND (cr_order_number = catalog_sales.cs_order_number))
                                                   Buffers: shared hit=54055
                     ->  Subquery Scan on wsr  (cost=282294.73..282298.04 rows=21 width=160) (actual time=3853.038..3860.403 rows=21 loops=1)
                           Buffers: shared hit=717895
                           ->  GroupAggregate  (cost=282294.73..282297.73 rows=21 width=113) (actual time=3853.027..3860.376 rows=21 loops=1)
                                 Group Key: web_site.web_site_id
                                 Buffers: shared hit=717895
                                 ->  Sort  (cost=282294.73..282295.17 rows=175 width=41) (actual time=3852.654..3853.418 rows=8720 loops=1)
                                       Sort Key: web_site.web_site_id
                                       Sort Method: quicksort  Memory: 1066kB
                                       Buffers: shared hit=717895
                                       ->  Hash Join  (cost=2506.08..282288.21 rows=175 width=41) (actual time=15.788..3840.662 rows=8720 loops=1)
                                             Hash Cond: (web_sales.ws_web_site_sk = web_site.web_site_sk)
                                             Buffers: shared hit=717895
                                             ->  Nested Loop Left Join  (cost=2502.14..282283.77 rows=175 width=28) (actual time=15.719..3835.326 rows=8720 loops=1)
                                                   Buffers: shared hit=717892
                                                   ->  Nested Loop  (cost=2501.71..282204.36 rows=175 width=24) (actual time=15.696..3784.103 rows=8720 loops=1)
                                                         Buffers: shared hit=690849
                                                         ->  Nested Loop  (cost=2501.44..282152.30 rows=178 width=28) (actual time=15.683..3750.335 rows=8871 loops=1)
                                                               Buffers: shared hit=664239
                                                               ->  Hash Join  (cost=2501.15..281123.59 rows=3250 width=28) (actual time=15.469..3022.713 rows=158362 loops=1)
                                                                     Hash Cond: (web_sales.ws_sold_date_sk = date_dim_2.d_date_sk)
                                                                     Buffers: shared hit=189153
                                                                     ->  Seq Scan on web_sales  (cost=0.00..259726.89 rows=7197889 width=32) (actual time=0.004..1032.730 rows=7197566 loops=1)
                                                                           Buffers: shared hit=187748
                                                                     ->  Hash  (cost=2500.73..2500.73 rows=33 width=4) (actual time=15.100..15.101 rows=31 loops=1)
                                                                           Buckets: 1024  Batches: 1  Memory Usage: 10kB
                                                                           Buffers: shared hit=1405
                                                                           ->  Seq Scan on date_dim date_dim_2  (cost=0.00..2500.73 rows=33 width=4) (actual time=7.436..15.086 rows=31 loops=1)
                                                                                 Filter: ((d_date >= '2002-08-04'::date) AND (d_date <= '2002-09-03 00:00:00'::timestamp without time zone))
                                                                                 Rows Removed by Filter: 73018
                                                                                 Buffers: shared hit=1405
                                                               ->  Index Scan using item_pkey on item item_2  (cost=0.29..0.32 rows=1 width=4) (actual time=0.004..0.004 rows=0 loops=158362)
                                                                     Index Cond: (i_item_sk = web_sales.ws_item_sk)
                                                                     Filter: (i_current_price > '50'::numeric)
                                                                     Rows Removed by Filter: 1
                                                                     Buffers: shared hit=475086
                                                         ->  Index Scan using promotion_pkey on promotion promotion_2  (cost=0.27..0.29 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=8871)
                                                               Index Cond: (p_promo_sk = web_sales.ws_promo_sk)
                                                               Filter: (p_channel_tv = 'N'::bpchar)
                                                               Rows Removed by Filter: 0
                                                               Buffers: shared hit=26610
                                                   ->  Index Scan using web_returns_pkey on web_returns  (cost=0.42..0.45 rows=1 width=20) (actual time=0.005..0.005 rows=0 loops=8720)
                                                         Index Cond: ((wr_item_sk = web_sales.ws_item_sk) AND (wr_order_number = web_sales.ws_order_number))
                                                         Buffers: shared hit=27043
                                             ->  Hash  (cost=3.42..3.42 rows=42 width=21) (actual time=0.056..0.056 rows=42 loops=1)
                                                   Buckets: 1024  Batches: 1  Memory Usage: 11kB
                                                   Buffers: shared hit=3
                                                   ->  Seq Scan on web_site  (cost=0.00..3.42 rows=42 width=21) (actual time=0.018..0.032 rows=42 loops=1)
                                                         Buffers: shared hit=3
 Planning:
   Buffers: shared hit=1599
 Planning Time: 13.315 ms
 Execution Time: 20260.918 ms
(159 rows)

