                                                                                    QUERY PLAN                                                                                     
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=107004.72..107004.73 rows=1 width=32) (actual time=1185.548..1185.553 rows=1 loops=1)
   Buffers: shared hit=514784
   ->  Aggregate  (cost=107004.72..107004.73 rows=1 width=32) (actual time=1185.546..1185.550 rows=1 loops=1)
         Buffers: shared hit=514784
         ->  Hash Join  (cost=8240.55..107004.71 rows=5 width=6) (actual time=71.043..1185.454 rows=183 loops=1)
               Hash Cond: (catalog_sales.cs_item_sk = item.i_item_sk)
               Join Filter: (catalog_sales.cs_ext_discount_amt > (SubPlan 1))
               Rows Removed by Join Filter: 453
               Buffers: shared hit=514784
               ->  Nested Loop  (cost=0.43..98716.71 rows=18240 width=10) (actual time=8.764..329.690 rows=408055 loops=1)
                     Buffers: shared hit=13006
                     ->  Seq Scan on date_dim  (cost=0.00..2500.73 rows=93 width=4) (actual time=8.718..17.094 rows=91 loops=1)
                           Filter: ((d_date >= '1999-02-22'::date) AND (d_date <= '1999-05-23 00:00:00'::timestamp without time zone))
                           Rows Removed by Filter: 72958
                           Buffers: shared hit=1405
                     ->  Index Scan using catalog_sales_cs_sold_date_sk_idx on catalog_sales  (cost=0.43..956.46 rows=7812 width=14) (actual time=0.016..1.653 rows=4484 loops=91)
                           Index Cond: (cs_sold_date_sk = date_dim.d_date_sk)
                           Buffers: shared hit=11601
               ->  Hash  (cost=8239.00..8239.00 rows=89 width=4) (actual time=58.769..58.770 rows=147 loops=1)
                     Buckets: 1024  Batches: 1  Memory Usage: 14kB
                     Buffers: shared hit=6964
                     ->  Seq Scan on item  (cost=0.00..8239.00 rows=89 width=4) (actual time=1.700..58.695 rows=147 loops=1)
                           Filter: (i_manufact_id = 283)
                           Rows Removed by Filter: 101853
                           Buffers: shared hit=6964
               SubPlan 1
                 ->  Aggregate  (cost=1903.89..1903.90 rows=1 width=32) (actual time=1.124..1.124 rows=1 loops=636)
                       Buffers: shared hit=494814
                       ->  Nested Loop  (cost=6.08..1903.88 rows=1 width=6) (actual time=0.402..1.117 rows=9 loops=636)
                             Buffers: shared hit=494814
                             ->  Bitmap Heap Scan on catalog_sales catalog_sales_1  (cost=5.79..696.62 rows=175 width=10) (actual time=0.076..0.443 rows=194 loops=636)
                                   Recheck Cond: (cs_item_sk = item.i_item_sk)
                                   Heap Blocks: exact=123546
                                   Buffers: shared hit=125511
                                   ->  Bitmap Index Scan on catalog_sales_cs_item_sk_idx  (cost=0.00..5.75 rows=175 width=0) (actual time=0.036..0.036 rows=194 loops=636)
                                         Index Cond: (cs_item_sk = item.i_item_sk)
                                         Buffers: shared hit=1965
                             ->  Index Scan using date_dim_pkey on date_dim date_dim_1  (cost=0.29..6.90 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=123598)
                                   Index Cond: (d_date_sk = catalog_sales_1.cs_sold_date_sk)
                                   Filter: ((d_date >= '1999-02-22'::date) AND (d_date <= '1999-05-23 00:00:00'::timestamp without time zone))
                                   Rows Removed by Filter: 1
                                   Buffers: shared hit=369303
 Planning:
   Buffers: shared hit=617
 Planning Time: 3.112 ms
 Execution Time: 1185.719 ms
(46 rows)

