title: SQL performance issue in where clause
body: <p>I am running a query on SQLSERVER 2008. The query is taking 4 seconds to process. I cannot understand why it's taking so long.</p>
  
  <pre><code>SELECT tbl_Operations.Workcenter
  ,SUM(tbl_Used_Components.Used_Quantity) as CNF_TODAY
  FROM tbl_Used_Components
  JOIN tbl_Pack_Division on tbl_Pack_Division.Pack_Division_ID =        
  tbl_Used_Components.Pack_Division_ID
  JOIN tbl_Operations on tbl_Operations.Operation_ID = tbl_Pack_Division.Operation_ID
  
  where CONVERT(date, tbl_Pack_Division.Stop_Time) = CONVERT(date, getdate())
  AND tbl_Pack_Division.Memo = 'NORMAL'
  and tbl_Pack_Division.Status = 'CNF_MACH'
  GROUP BY tbl_Operations.Workcenter
  </code></pre>
  
  <p>The problem is in the where clause. When i run the query without Where clause it runs in 0.1 second. When I add the first 2 arguments it still runs fine. But when I add the third argument on Status-field it goes wrong. </p>
  
  <p>How can this be a problem? It is a selection on the same granularity as the seond one (Memo-field).</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Status  varchar(10) -- Can have 5 different values</p>
  
  <p>Memo    varchar(150)    </p>
  
  <p>Only index: Pack_Division_ID    bigint  </p>
  
  <p><a href="http://copytaste.com/o1452" rel="nofollow">XML Execution plan</a></p>