                                                                                          QUERY PLAN                                                                                           
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=1081120.72..1081120.97 rows=100 width=163) (actual time=6655.792..6655.825 rows=100 loops=1)
   Buffers: shared hit=760168
   ->  Sort  (cost=1081120.72..1081450.76 rows=132016 width=163) (actual time=6655.789..6655.811 rows=100 loops=1)
         Sort Key: ('store'::text), ('ss_customer_sk'::text), date_dim.d_year, date_dim.d_qoy, item.i_category
         Sort Method: top-N heapsort  Memory: 48kB
         Buffers: shared hit=760168
         ->  HashAggregate  (cost=1074424.97..1076075.17 rows=132016 width=163) (actual time=6652.630..6654.501 rows=653 loops=1)
               Group Key: ('store'::text), ('ss_customer_sk'::text), date_dim.d_year, date_dim.d_qoy, item.i_category
               Batches: 1  Memory Usage: 6681kB
               Buffers: shared hit=760159
               ->  Append  (cost=26911.91..1051322.24 rows=1320156 width=129) (actual time=688.884..5620.381 rows=684810 loops=1)
                     Buffers: shared hit=760159
                     ->  Hash Join  (cost=26911.91..563546.44 rows=1244449 width=129) (actual time=688.883..3012.672 rows=648196 loops=1)
                           Hash Cond: (store_sales.ss_item_sk = item.i_item_sk)
                           Buffers: shared hit=485391
                           ->  Hash Join  (cost=17652.91..551020.63 rows=1244449 width=18) (actual time=585.320..2462.384 rows=648196 loops=1)
                                 Hash Cond: (store_sales.ss_sold_date_sk = date_dim.d_date_sk)
                                 Buffers: shared hit=478427
                                 ->  Bitmap Heap Scan on store_sales  (cost=14604.31..544549.56 rows=1303725 width=14) (actual time=536.598..1810.435 rows=1296253 loops=1)
                                       Recheck Cond: (ss_customer_sk IS NULL)
                                       Heap Blocks: exact=475928
                                       Buffers: shared hit=477022
                                       ->  Bitmap Index Scan on store_sales_ss_customer_sk_idx  (cost=0.00..14278.38 rows=1303725 width=0) (actual time=260.345..260.346 rows=1296253 loops=1)
                                             Index Cond: (ss_customer_sk IS NULL)
                                             Buffers: shared hit=1094
                                 ->  Hash  (cost=2135.49..2135.49 rows=73049 width=12) (actual time=48.366..48.368 rows=73049 loops=1)
                                       Buckets: 131072  Batches: 1  Memory Usage: 4163kB
                                       Buffers: shared hit=1405
                                       ->  Seq Scan on date_dim  (cost=0.00..2135.49 rows=73049 width=12) (actual time=0.012..25.697 rows=73049 loops=1)
                                             Buffers: shared hit=1405
                           ->  Hash  (cost=7984.00..7984.00 rows=102000 width=55) (actual time=103.030..103.031 rows=102000 loops=1)
                                 Buckets: 131072  Batches: 1  Memory Usage: 9778kB
                                 Buffers: shared hit=6964
                                 ->  Seq Scan on item  (cost=0.00..7984.00 rows=102000 width=55) (actual time=0.028..64.643 rows=102000 loops=1)
                                       Buffers: shared hit=6964
                     ->  Hash Join  (cost=9259.30..272615.43 rows=3118 width=129) (actual time=98.626..2048.294 rows=869 loops=1)
                           Hash Cond: (web_sales.ws_item_sk = item_1.i_item_sk)
                           Buffers: shared hit=196665
                           ->  Nested Loop  (cost=0.30..263348.25 rows=3118 width=18) (actual time=1.268..1949.795 rows=869 loops=1)
                                 Buffers: shared hit=189701
                                 ->  Seq Scan on web_sales  (cost=0.00..259726.89 rows=3119 width=14) (actual time=0.952..1942.734 rows=1774 loops=1)
                                       Filter: (ws_ship_hdemo_sk IS NULL)
                                       Rows Removed by Filter: 7195792
                                       Buffers: shared hit=187748
                                 ->  Result Cache  (cost=0.30..2.38 rows=1 width=12) (actual time=0.003..0.003 rows=0 loops=1774)
                                       Cache Key: web_sales.ws_sold_date_sk
                                       Hits: 1122  Misses: 652  Evictions: 0  Overflows: 0  Memory Usage: 72kB
                                       Buffers: shared hit=1953
                                       ->  Index Scan using date_dim_pkey on date_dim date_dim_1  (cost=0.29..2.37 rows=1 width=12) (actual time=0.005..0.005 rows=1 loops=652)
                                             Index Cond: (d_date_sk = web_sales.ws_sold_date_sk)
                                             Buffers: shared hit=1953
                           ->  Hash  (cost=7984.00..7984.00 rows=102000 width=55) (actual time=96.884..96.885 rows=102000 loops=1)
                                 Buckets: 131072  Batches: 1  Memory Usage: 9778kB
                                 Buffers: shared hit=6964
                                 ->  Seq Scan on item item_1  (cost=0.00..7984.00 rows=102000 width=55) (actual time=0.006..59.850 rows=102000 loops=1)
                                       Buffers: shared hit=6964
                     ->  Hash Join  (cost=10093.22..195358.03 rows=72589 width=129) (actual time=140.531..455.520 rows=35745 loops=1)
                           Hash Cond: (catalog_sales.cs_item_sk = item_2.i_item_sk)
                           Buffers: shared hit=78103
                           ->  Nested Loop  (cost=834.22..185908.47 rows=72589 width=18) (actual time=46.023..333.257 rows=35745 loops=1)
                                 Buffers: shared hit=71139
                                 ->  Bitmap Heap Scan on catalog_sales  (cost=833.92..183353.85 rows=72966 width=14) (actual time=45.988..250.376 rows=71734 loops=1)
                                       Recheck Cond: (cs_bill_customer_sk IS NULL)
                                       Heap Blocks: exact=65571
                                       Buffers: shared hit=65634
                                       ->  Bitmap Index Scan on catalog_sales_cs_bill_customer_sk_idx  (cost=0.00..815.68 rows=72966 width=0) (actual time=21.376..21.377 rows=71734 loops=1)
                                             Index Cond: (cs_bill_customer_sk IS NULL)
                                             Buffers: shared hit=63
                                 ->  Result Cache  (cost=0.30..0.41 rows=1 width=12) (actual time=0.000..0.000 rows=0 loops=71734)
                                       Cache Key: catalog_sales.cs_sold_date_sk
                                       Hits: 69898  Misses: 1836  Evictions: 0  Overflows: 0  Memory Usage: 201kB
                                       Buffers: shared hit=5505
                                       ->  Index Scan using date_dim_pkey on date_dim date_dim_2  (cost=0.29..0.40 rows=1 width=12) (actual time=0.004..0.004 rows=1 loops=1836)
                                             Index Cond: (d_date_sk = catalog_sales.cs_sold_date_sk)
                                             Buffers: shared hit=5505
                           ->  Hash  (cost=7984.00..7984.00 rows=102000 width=55) (actual time=94.470..94.471 rows=102000 loops=1)
                                 Buckets: 131072  Batches: 1  Memory Usage: 9778kB
                                 Buffers: shared hit=6964
                                 ->  Seq Scan on item item_2  (cost=0.00..7984.00 rows=102000 width=55) (actual time=0.011..59.360 rows=102000 loops=1)
                                       Buffers: shared hit=6964
 Planning:
   Buffers: shared hit=719
 Planning Time: 4.346 ms
 Execution Time: 6661.850 ms
(84 rows)

