                                                                                                                                         QUERY PLAN                                                                                                                                         
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Sort  (cost=889076.00..889077.43 rows=575 width=77)
   Sort Key: customer.c_last_name, customer.c_first_name, customer.c_salutation, customer.c_preferred_cust_flag DESC, store_sales.ss_ticket_number
   ->  Nested Loop  (cost=884501.84..889049.64 rows=575 width=77)
         ->  GroupAggregate  (cost=884501.42..884630.89 rows=575 width=16)
               Group Key: store_sales.ss_ticket_number, store_sales.ss_customer_sk
               Filter: ((count(*) >= 15) AND (count(*) <= 20))
               ->  Sort  (cost=884501.42..884514.36 rows=5179 width=8)
                     Sort Key: store_sales.ss_ticket_number, store_sales.ss_customer_sk
                     ->  Hash Join  (cost=3408.22..884181.91 rows=5179 width=8)
                           Hash Cond: (store_sales.ss_store_sk = store.s_store_sk)
                           ->  Hash Join  (cost=3399.98..884157.96 rows=5756 width=12)
                                 Hash Cond: (store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)
                                 ->  Hash Join  (cost=3142.86..883667.57 rows=88817 width=16)
                                       Hash Cond: (store_sales.ss_sold_date_sk = date_dim.d_date_sk)
                                       ->  Seq Scan on store_sales  (cost=0.00..804917.92 rows=28800992 width=20)
                                       ->  Hash  (cost=3139.91..3139.91 rows=236 width=4)
                                             ->  Seq Scan on date_dim  (cost=0.00..3139.91 rows=236 width=4)
                                                   Filter: ((d_year = ANY ('{2000,2001,2002}'::integer[])) AND (((d_dom >= 1) AND (d_dom <= 3)) OR ((d_dom >= 25) AND (d_dom <= 28))))
                                 ->  Hash  (cost=251.00..251.00 rows=489 width=4)
                                       ->  Seq Scan on household_demographics  (cost=0.00..251.00 rows=489 width=4)
                                             Filter: ((hd_vehicle_count > 0) AND ((hd_buy_potential = '501-1000'::bpchar) OR (hd_buy_potential = 'Unknown'::bpchar)) AND ((CASE WHEN (hd_vehicle_count > 0) THEN (hd_dep_count / hd_vehicle_count) ELSE NULL::integer END)::numeric > 1.2))
                           ->  Hash  (cost=7.04..7.04 rows=96 width=4)
                                 ->  Seq Scan on store  (cost=0.00..7.04 rows=96 width=4)
                                       Filter: ((s_county)::text = ANY ('{"Williamson County","Williamson County","Williamson County","Williamson County","Williamson County","Williamson County","Williamson County","Williamson County"}'::text[]))
         ->  Index Scan using customer_pkey on customer  (cost=0.42..7.67 rows=1 width=69)
               Index Cond: (c_customer_sk = store_sales.ss_customer_sk)
(26 rows)

