                                                                               QUERY PLAN                                                                                
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=940757.89..940761.39 rows=100 width=145) (actual time=15514.886..15515.410 rows=100 loops=1)
   Buffers: shared hit=987912
   ->  GroupAggregate  (cost=940757.89..940819.84 rows=1770 width=145) (actual time=15514.884..15515.392 rows=100 loops=1)
         Group Key: item.i_item_id
         Buffers: shared hit=987912
         ->  Sort  (cost=940757.89..940762.31 rows=1770 width=36) (actual time=15514.847..15514.870 rows=192 loops=1)
               Sort Key: item.i_item_id
               Sort Method: quicksort  Memory: 8892kB
               Buffers: shared hit=987912
               ->  Nested Loop  (cost=58106.19..940662.40 rows=1770 width=36) (actual time=543.822..15165.373 rows=74484 loops=1)
                     Buffers: shared hit=987909
                     ->  Nested Loop  (cost=58105.90..939536.08 rows=1770 width=23) (actual time=543.804..14782.775 rows=74484 loops=1)
                           Buffers: shared hit=764457
                           ->  Hash Join  (cost=58105.62..938988.94 rows=1855 width=27) (actual time=543.774..14508.820 rows=75616 loops=1)
                                 Hash Cond: (store_sales.ss_cdemo_sk = customer_demographics.cd_demo_sk)
                                 Buffers: shared hit=540141
                                 ->  Hash Join  (cost=2322.65..882847.36 rows=136613 width=31) (actual time=18.768..12851.814 rows=5470761 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=35) (actual time=0.007..3933.751 rows=28800991 loops=1)
                                             Buffers: shared hit=516908
                                       ->  Hash  (cost=2318.11..2318.11 rows=363 width=4) (actual time=18.725..18.726 rows=365 loops=1)
                                             Buckets: 1024  Batches: 1  Memory Usage: 21kB
                                             Buffers: shared hit=1405
                                             ->  Seq Scan on date_dim  (cost=0.00..2318.11 rows=363 width=4) (actual time=9.563..18.617 rows=365 loops=1)
                                                   Filter: (d_year = 2001)
                                                   Rows Removed by Filter: 72684
                                                   Buffers: shared hit=1405
                                 ->  Hash  (cost=55442.00..55442.00 rows=27278 width=4) (actual time=524.072..524.073 rows=27440 loops=1)
                                       Buckets: 32768  Batches: 1  Memory Usage: 1221kB
                                       Buffers: shared hit=21828
                                       ->  Seq Scan on customer_demographics  (cost=0.00..55442.00 rows=27278 width=4) (actual time=0.025..514.182 rows=27440 loops=1)
                                             Filter: ((cd_gender = 'M'::bpchar) AND (cd_marital_status = 'M'::bpchar) AND (cd_education_status = '4 yr Degree'::bpchar))
                                             Rows Removed by Filter: 1893360
                                             Buffers: shared hit=21828
                           ->  Index Scan using promotion_pkey on promotion  (cost=0.27..0.30 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=75616)
                                 Index Cond: (p_promo_sk = store_sales.ss_promo_sk)
                                 Filter: ((p_channel_email = 'N'::bpchar) OR (p_channel_event = 'N'::bpchar))
                                 Rows Removed by Filter: 0
                                 Buffers: shared hit=224316
                     ->  Index Scan using item_pkey on item  (cost=0.29..0.64 rows=1 width=21) (actual time=0.004..0.004 rows=1 loops=74484)
                           Index Cond: (i_item_sk = store_sales.ss_item_sk)
                           Buffers: shared hit=223452
 Planning:
   Buffers: shared hit=565
 Planning Time: 3.619 ms
 Execution Time: 15516.660 ms
(47 rows)

