                                                                                 QUERY PLAN                                                                                  
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=948740.37..948743.25 rows=100 width=152) (actual time=12810.419..12810.892 rows=100 loops=1)
   Buffers: shared hit=778503
   ->  GroupAggregate  (cost=948740.37..948832.11 rows=3191 width=152) (actual time=12810.416..12810.874 rows=100 loops=1)
         Group Key: item.i_item_id, store.s_state
         Group Key: item.i_item_id
         Group Key: ()
         Buffers: shared hit=778503
         ->  Sort  (cost=948740.37..948744.36 rows=1595 width=39) (actual time=12810.379..12810.391 rows=69 loops=1)
               Sort Key: item.i_item_id, store.s_state
               Sort Method: quicksort  Memory: 2856kB
               Buffers: shared hit=778503
               ->  Nested Loop  (cost=55786.48..948655.53 rows=1595 width=39) (actual time=588.081..12682.505 rows=26725 loops=1)
                     Buffers: shared hit=778500
                     ->  Nested Loop  (cost=55786.18..947641.48 rows=1595 width=26) (actual time=588.055..12516.688 rows=26725 loops=1)
                           Buffers: shared hit=698325
                           ->  Nested Loop  (cost=55786.04..947328.69 rows=1870 width=27) (actual time=578.437..12272.454 rows=77987 loops=1)
                                 Buffers: shared hit=544205
                                 ->  Hash Join  (cost=55785.74..936306.42 rows=394267 width=31) (actual time=574.360..11963.159 rows=392344 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..3873.331 rows=28800991 loops=1)
                                             Buffers: shared hit=516908
                                       ->  Hash  (cost=55442.00..55442.00 rows=27499 width=4) (actual time=574.097..574.098 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.026..564.176 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
                                 ->  Result Cache  (cost=0.30..0.65 rows=1 width=4) (actual time=0.000..0.000 rows=0 loops=392344)
                                       Cache Key: store_sales.ss_sold_date_sk
                                       Hits: 390520  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 = 2000)
                                             Rows Removed by Filter: 1
                                             Buffers: shared hit=5469
                           ->  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: 4.489 ms
 Execution Time: 12812.017 ms
(50 rows)

