                                                                                  QUERY PLAN                                                                                   
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=949015.67..949019.17 rows=100 width=145) (actual time=13279.647..13280.167 rows=100 loops=1)
   Buffers: shared hit=991976
   ->  GroupAggregate  (cost=949015.67..949077.62 rows=1770 width=145) (actual time=13279.644..13280.149 rows=100 loops=1)
         Group Key: item.i_item_id
         Buffers: shared hit=991976
         ->  Sort  (cost=949015.67..949020.10 rows=1770 width=36) (actual time=13279.611..13279.634 rows=192 loops=1)
               Sort Key: item.i_item_id
               Sort Method: quicksort  Memory: 8892kB
               Buffers: shared hit=991976
               ->  Nested Loop  (cost=55783.84..948920.19 rows=1770 width=36) (actual time=533.346..12928.427 rows=74484 loops=1)
                     Buffers: shared hit=991973
                     ->  Nested Loop  (cost=55783.55..947793.87 rows=1770 width=23) (actual time=533.330..12508.860 rows=74484 loops=1)
                           Buffers: shared hit=768521
                           ->  Nested Loop  (cost=55783.28..947246.73 rows=1855 width=27) (actual time=533.313..12235.509 rows=75616 loops=1)
                                 Buffers: shared hit=544205
                                 ->  Hash Join  (cost=55782.97..936303.65 rows=391099 width=31) (actual time=533.275..11935.856 rows=390952 loops=1)
                                       Hash Cond: (store_sales.ss_cdemo_sk = customer_demographics.cd_demo_sk)
                                       Buffers: shared hit=538736
                                       ->  Seq Scan on store_sales  (cost=0.00..804917.92 rows=28800992 width=35) (actual time=0.007..3878.774 rows=28800991 loops=1)
                                             Buffers: shared hit=516908
                                       ->  Hash  (cost=55442.00..55442.00 rows=27278 width=4) (actual time=532.462..532.463 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.028..522.717 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
                                 ->  Result Cache  (cost=0.30..0.65 rows=1 width=4) (actual time=0.000..0.000 rows=0 loops=390952)
                                       Cache Key: store_sales.ss_sold_date_sk
                                       Hits: 389128  Misses: 1824  Evictions: 0  Overflows: 0  Memory Usage: 134kB
                                       Buffers: shared hit=5469
                                       ->  Index Scan using date_dim_pkey on date_dim  (cost=0.29..0.64 rows=1 width=4) (actual time=0.004..0.004 rows=0 loops=1824)
                                             Index Cond: (d_date_sk = store_sales.ss_sold_date_sk)
                                             Filter: (d_year = 2001)
                                             Rows Removed by Filter: 1
                                             Buffers: shared hit=5469
                           ->  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.005..0.005 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: 4.691 ms
 Execution Time: 13281.232 ms
(48 rows)

