                                                                                 QUERY PLAN                                                                                 
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=289389.07..289389.07 rows=1 width=32) (actual time=3135.749..3135.757 rows=1 loops=1)
   Buffers: shared hit=207089
   ->  Sort  (cost=289389.07..289389.07 rows=1 width=32) (actual time=3135.747..3135.754 rows=1 loops=1)
         Sort Key: (sum(web_sales.ws_ext_discount_amt))
         Sort Method: quicksort  Memory: 25kB
         Buffers: shared hit=207089
         ->  Aggregate  (cost=289389.05..289389.06 rows=1 width=32) (actual time=3135.718..3135.724 rows=1 loops=1)
               Buffers: shared hit=207086
               ->  Hash Join  (cost=10742.03..289389.04 rows=3 width=6) (actual time=127.731..3135.699 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=207086
                     ->  Hash Join  (cost=2501.92..281124.36 rows=9357 width=10) (actual time=18.394..3014.302 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.020..1008.019 rows=7197566 loops=1)
                                 Buffers: shared hit=187748
                           ->  Hash  (cost=2500.73..2500.73 rows=95 width=4) (actual time=18.335..18.336 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.214..18.303 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.914..59.914 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.528..59.891 rows=21 loops=1)
                                 Filter: (i_manufact_id = 914)
                                 Rows Removed by Filter: 101979
                                 Buffers: shared hit=6964
                     SubPlan 1
                       ->  Aggregate  (cost=991.90..991.91 rows=1 width=32) (actual time=0.603..0.603 rows=1 loops=35)
                             Buffers: shared hit=10969
                             ->  Nested Loop  (cost=5.39..991.89 rows=1 width=6) (actual time=0.199..0.590 rows=5 loops=35)
                                   Buffers: shared hit=10969
                                   ->  Bitmap Heap Scan on web_sales web_sales_1  (cost=5.10..344.65 rows=86 width=10) (actual time=0.048..0.276 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.028..0.028 rows=78 loops=35)
                                               Index Cond: (ws_item_sk = item.i_item_sk)
                                               Buffers: shared hit=105
                                   ->  Index Scan using date_dim_pkey on date_dim date_dim_1  (cost=0.29..7.52 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=2716)
                                         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=8148
 Planning:
   Buffers: shared hit=276
 Planning Time: 1.730 ms
 Execution Time: 3135.942 ms
(53 rows)

