title: Suggestions for improving count performance on a SQL query?
body: <p>I've got a query that is taking a very long time to run due to a select similar to:</p>
  
  <pre><code>SELECT 
  Count( Distinct t1.v1),
  Count (Distinct 
  Case t2.v1 When 'blah' then t1.v1
  Else null
  End ),
  ....
  FROM t1
  LEFT JOIN t2 ON t1.v3 = t2.v3
  WHERE t1.myDate BETWEEN @start and @end
  AND t2.v5 = @id
  </code></pre>
  
  <p>Can anyone suggest any good methods for improving this performance?</p>