title: sql Query Taking Too long in production
body: <p>I have a query which is working proper in local DB with small dataset, but in production it is taking too long, any help on this will be good:</p>
  
  <pre><code>SELECT su.orgid, arc.userid, 
      SUM(IF(arc.create_dt&gt;CURRENT_DATE - INTERVAL 1 WEEK,arc.processed_records,0)) Record_Week, 
      SUM(IF(arc.create_dt&gt;CURRENT_DATE - INTERVAL 1 MONTH,arc.processed_records,0)) Record_Month, 
      SUM(IF(arc.create_dt&gt;CURRENT_DATE - INTERVAL 3 MONTH,arc.processed_records,0)) Record_3Month, 
      SUM(IF(arc.create_dt&gt;CURRENT_DATE - INTERVAL 6 MONTH,arc.processed_records,0)) Record_6Month, 
      SUM(IF(arc.create_dt&gt;CURRENT_DATE - INTERVAL 1 YEAR,arc.processed_records,0)) Record_Year 
  FROM archive.log_archive arc 
  INNER JOIN prod_db.user su ON su.name = arc.userid
  </code></pre>