title: Snowflake Performance issues when querying large tables
body: <p>I am trying to query a table which has 1Tb of data clustered by Date and Company. A simple query is taking long time</p>
  
  <p>Posting the query and query profile</p>
  
  <pre><code>SELECT
      sl.customer_code,
      qt_product_category_l3_sid,
      qt_product_brand_sid,
      sl.partner_code,
      sl.transaction_id,
      dollars_spent,
      units,
      user_pii_sid,
      promo_flag,
      media_flag
  FROM 
      cdw_dwh.public.qi_sg_promo_media_sales_lines_fact sl
  WHERE  
      transaction_date_id &gt;= (to_char(current_date - (52*7) , 'yyyymmdd')  ) 
      AND sl.partner_code IN ('All Retailers')
      AND qt_product_category_l3_sid IN (SELECT DISTINCT qt_product_category_l3_sid 
                                         FROM cdw_dwh.PUBLIC.qi_sg_prompt_category_major_brand 
                                         WHERE qt_product_category_l1_sid IN (246))
                                           AND qt_product_brand_sid IN (SELECT qt_product_brand_sid 
                                                                        FROM cdw_dwh.PUBLIC.qi_sg_prompt_category_major_brand 
                                                                        WHERE qt_product_major_brand_sid IN (246903, 430138))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/h07wn.png" rel="nofollow noreferrer">enter image description here</a></p>