                                                                              QUERY PLAN                                                                               
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=940403.39..940406.26 rows=100 width=152) (actual time=14931.244..14931.714 rows=100 loops=1)
   Buffers: shared hit=774439
   ->  GroupAggregate  (cost=940403.39..940495.12 rows=3191 width=152) (actual time=14931.241..14931.696 rows=100 loops=1)
         Group Key: item.i_item_id, store.s_state
         Group Key: item.i_item_id
         Group Key: ()
         Buffers: shared hit=774439
         ->  Sort  (cost=940403.39..940407.37 rows=1595 width=39) (actual time=14931.200..14931.212 rows=69 loops=1)
               Sort Key: item.i_item_id, store.s_state
               Sort Method: quicksort  Memory: 2856kB
               Buffers: shared hit=774439
               ->  Nested Loop  (cost=58108.82..940318.54 rows=1595 width=39) (actual time=558.726..14803.839 rows=26725 loops=1)
                     Buffers: shared hit=774436
                     ->  Nested Loop  (cost=58108.53..939304.49 rows=1595 width=26) (actual time=558.704..14652.153 rows=26725 loops=1)
                           Buffers: shared hit=694261
                           ->  Hash Join  (cost=58108.39..938991.70 rows=1870 width=27) (actual time=547.522..14406.509 rows=77987 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.980..12744.806 rows=5519143 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..3944.011 rows=28800991 loops=1)
                                             Buffers: shared hit=516908
                                       ->  Hash  (cost=2318.11..2318.11 rows=363 width=4) (actual time=18.960..18.961 rows=366 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.623..18.846 rows=366 loops=1)
                                                   Filter: (d_year = 2000)
                                                   Rows Removed by Filter: 72683
                                                   Buffers: shared hit=1405
                                 ->  Hash  (cost=55442.00..55442.00 rows=27499 width=4) (actual time=523.675..523.675 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=27499 width=4) (actual time=0.019..513.955 rows=27440 loops=1)
                                             Filter: ((cd_gender = 'M'::bpchar) AND (cd_marital_status = 'U'::bpchar) AND (cd_education_status = 'Secondary'::bpchar))
                                             Rows Removed by Filter: 1893360
                                             Buffers: shared hit=21828
                           ->  Index Scan using store_pkey on store  (cost=0.14..0.17 rows=1 width=7) (actual time=0.003..0.003 rows=0 loops=77987)
                                 Index Cond: (s_store_sk = store_sales.ss_store_sk)
                                 Filter: (s_state = ANY ('{TN,TN,TN,TN,TN,TN}'::bpchar[]))
                                 Rows Removed by Filter: 1
                                 Buffers: shared hit=154120
                     ->  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=26725)
                           Index Cond: (i_item_sk = store_sales.ss_item_sk)
                           Buffers: shared hit=80175
 Planning:
   Buffers: shared hit=522
 Planning Time: 3.424 ms
 Execution Time: 14932.201 ms
(49 rows)

