                                                                                   QUERY PLAN                                                                                    
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=289389.07..289389.07 rows=1 width=32) (actual time=3075.013..3075.021 rows=1 loops=1)
   Buffers: shared hit=200456
   ->  Sort  (cost=289389.07..289389.07 rows=1 width=32) (actual time=3075.010..3075.018 rows=1 loops=1)
         Sort Key: (sum(web_sales.ws_ext_discount_amt))
         Sort Method: quicksort  Memory: 25kB
         Buffers: shared hit=200456
         ->  Aggregate  (cost=289389.05..289389.06 rows=1 width=32) (actual time=3074.983..3074.990 rows=1 loops=1)
               Buffers: shared hit=200453
               ->  Hash Join  (cost=10742.03..289389.04 rows=3 width=6) (actual time=126.520..3074.967 rows=10 loops=1)
                     Hash Cond: (web_sales.ws_item_sk = item.i_item_sk)
                     Join Filter: (web_sales.ws_ext_discount_amt > (SubPlan 1))
                     Rows Removed by Join Filter: 25
                     Buffers: shared hit=200453
                     ->  Hash Join  (cost=2501.92..281124.36 rows=9357 width=10) (actual time=18.819..2960.539 rows=205584 loops=1)
                           Hash Cond: (web_sales.ws_sold_date_sk = date_dim.d_date_sk)
                           Buffers: shared hit=189153
                           ->  Seq Scan on web_sales  (cost=0.00..259726.89 rows=7197889 width=14) (actual time=0.018..1010.164 rows=7197566 loops=1)
                                 Buffers: shared hit=187748
                           ->  Hash  (cost=2500.73..2500.73 rows=95 width=4) (actual time=18.768..18.769 rows=91 loops=1)
                                 Buckets: 1024  Batches: 1  Memory Usage: 12kB
                                 Buffers: shared hit=1405
                                 ->  Seq Scan on date_dim  (cost=0.00..2500.73 rows=95 width=4) (actual time=9.185..18.733 rows=91 loops=1)
                                       Filter: ((d_date >= '2001-01-25'::date) AND (d_date <= '2001-04-25 00:00:00'::timestamp without time zone))
                                       Rows Removed by Filter: 72958
                                       Buffers: shared hit=1405
                     ->  Hash  (cost=8239.00..8239.00 rows=89 width=4) (actual time=59.098..59.099 rows=21 loops=1)
                           Buckets: 1024  Batches: 1  Memory Usage: 9kB
                           Buffers: shared hit=6964
                           ->  Seq Scan on item  (cost=0.00..8239.00 rows=89 width=4) (actual time=11.494..59.074 rows=21 loops=1)
                                 Filter: (i_manufact_id = 914)
                                 Rows Removed by Filter: 101979
                                 Buffers: shared hit=6964
                     SubPlan 1
                       ->  Aggregate  (cost=979.02..979.03 rows=1 width=32) (actual time=0.420..0.420 rows=1 loops=35)
                             Buffers: shared hit=4336
                             ->  Nested Loop  (cost=5.40..979.01 rows=1 width=6) (actual time=0.143..0.407 rows=5 loops=35)
                                   Buffers: shared hit=4336
                                   ->  Bitmap Heap Scan on web_sales web_sales_1  (cost=5.10..344.65 rows=86 width=10) (actual time=0.047..0.271 rows=78 loops=35)
                                         Recheck Cond: (ws_item_sk = item.i_item_sk)
                                         Heap Blocks: exact=2716
                                         Buffers: shared hit=2821
                                         ->  Bitmap Index Scan on web_sales_pkey  (cost=0.00..5.08 rows=86 width=0) (actual time=0.027..0.027 rows=78 loops=35)
                                               Index Cond: (ws_item_sk = item.i_item_sk)
                                               Buffers: shared hit=105
                                   ->  Result Cache  (cost=0.30..7.53 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=2716)
                                         Cache Key: web_sales_1.ws_sold_date_sk
                                         Hits: 2211  Misses: 505  Evictions: 0  Overflows: 0  Memory Usage: 35kB
                                         Buffers: shared hit=1515
                                         ->  Index Scan using date_dim_pkey on date_dim date_dim_1  (cost=0.29..7.52 rows=1 width=4) (actual time=0.004..0.004 rows=0 loops=505)
                                               Index Cond: (d_date_sk = web_sales_1.ws_sold_date_sk)
                                               Filter: ((d_date >= '2001-01-25'::date) AND (d_date <= '2001-04-25 00:00:00'::timestamp without time zone))
                                               Rows Removed by Filter: 1
                                               Buffers: shared hit=1515
 Planning:
   Buffers: shared hit=276
 Planning Time: 1.706 ms
 Execution Time: 3075.268 ms
(57 rows)

