                                                                                    QUERY PLAN                                                                                     
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=90629162.19..90629162.23 rows=17 width=11) (actual time=22441890.053..22441890.073 rows=51 loops=1)
   Buffers: shared hit=1783627133
   InitPlan 1 (returns $0)
     ->  Unique  (cost=2501.50..2501.66 rows=31 width=4) (actual time=20.894..20.905 rows=1 loops=1)
           Buffers: shared hit=1408
           ->  Sort  (cost=2501.50..2501.58 rows=31 width=4) (actual time=20.892..20.896 rows=31 loops=1)
                 Sort Key: date_dim.d_month_seq
                 Sort Method: quicksort  Memory: 26kB
                 Buffers: shared hit=1408
                 ->  Seq Scan on date_dim  (cost=0.00..2500.73 rows=31 width=4) (actual time=10.981..20.857 rows=31 loops=1)
                       Filter: ((d_year = 1998) AND (d_moy = 3))
                       Rows Removed by Filter: 73018
                       Buffers: shared hit=1405
   ->  Sort  (cost=90626660.53..90626660.57 rows=17 width=11) (actual time=22441890.050..22441890.058 rows=51 loops=1)
         Sort Key: (count(*)), a.ca_state
         Sort Method: quicksort  Memory: 27kB
         Buffers: shared hit=1783627133
         ->  GroupAggregate  (cost=90626632.60..90626660.18 rows=17 width=11) (actual time=22441881.684..22441889.990 rows=51 loops=1)
               Group Key: a.ca_state
               Filter: (count(*) >= 10)
               Rows Removed by Filter: 1
               Buffers: shared hit=1783627127
               ->  Sort  (cost=90626632.60..90626641.58 rows=3593 width=3) (actual time=22441881.609..22441883.710 rows=25697 loops=1)
                     Sort Key: a.ca_state
                     Sort Method: quicksort  Memory: 1961kB
                     Buffers: shared hit=1783627127
                     ->  Nested Loop  (cost=1.44..90626420.41 rows=3593 width=3) (actual time=379.347..22441785.489 rows=25697 loops=1)
                           Buffers: shared hit=1783627127
                           ->  Nested Loop  (cost=1.02..90623597.74 rows=3593 width=4) (actual time=379.291..22441142.413 rows=25697 loops=1)
                                 Buffers: shared hit=1783524339
                                 ->  Nested Loop  (cost=0.72..1534583.04 rows=10779 width=8) (actual time=23.379..32042.171 rows=255774 loops=1)
                                       Buffers: shared hit=1546881
                                       ->  Nested Loop  (cost=0.30..1526030.66 rows=11290 width=8) (actual time=23.348..26627.196 rows=262058 loops=1)
                                             Buffers: shared hit=523785
                                             ->  Seq Scan on store_sales s  (cost=0.00..804917.92 rows=28800992 width=12) (actual time=0.007..4564.567 rows=28800991 loops=1)
                                                   Buffers: shared hit=516908
                                             ->  Result Cache  (cost=0.30..0.61 rows=1 width=4) (actual time=0.000..0.000 rows=0 loops=28800991)
                                                   Cache Key: s.ss_sold_date_sk
                                                   Hits: 28799167  Misses: 1824  Evictions: 0  Overflows: 0  Memory Usage: 123kB
                                                   Buffers: shared hit=6877
                                                   ->  Index Scan using date_dim_pkey on date_dim d  (cost=0.29..0.60 rows=1 width=4) (actual time=0.016..0.016 rows=0 loops=1824)
                                                         Index Cond: (d_date_sk = s.ss_sold_date_sk)
                                                         Filter: (d_month_seq = $0)
                                                         Rows Removed by Filter: 1
                                                         Buffers: shared hit=6877
                                       ->  Index Scan using customer_pkey on customer c  (cost=0.42..0.76 rows=1 width=8) (actual time=0.016..0.016 rows=1 loops=262058)
                                             Index Cond: (c_customer_sk = s.ss_customer_sk)
                                             Buffers: shared hit=1023096
                                 ->  Index Scan using item_pkey on item i  (cost=0.29..8265.05 rows=1 width=4) (actual time=87.610..87.610 rows=0 loops=255774)
                                       Index Cond: (i_item_sk = s.ss_item_sk)
                                       Filter: (i_current_price > (1.2 * (SubPlan 2)))
                                       Rows Removed by Filter: 1
                                       Buffers: shared hit=1781977458
                                       SubPlan 2
                                         ->  Aggregate  (cost=8264.44..8264.45 rows=1 width=32) (actual time=87.592..87.592 rows=1 loops=255774)
                                               Buffers: shared hit=1781210136
                                               ->  Seq Scan on item j  (cost=0.00..8239.00 rows=10173 width=6) (actual time=0.125..84.680 rows=10155 loops=255774)
                                                     Filter: (i_category = i.i_category)
                                                     Rows Removed by Filter: 91845
                                                     Buffers: shared hit=1781210136
                           ->  Index Scan using customer_address_pkey on customer_address a  (cost=0.42..0.79 rows=1 width=7) (actual time=0.019..0.019 rows=1 loops=25697)
                                 Index Cond: (ca_address_sk = c.c_current_addr_sk)
                                 Buffers: shared hit=102788
 Planning:
   Buffers: shared hit=549
 Planning Time: 4.013 ms
 Execution Time: 22441898.341 ms
(67 rows)

