title: MYSQL Count(Distinct) Group By
body: <p>This select keeps timing out:</p>
  
  <pre><code>SELECT COUNT(DISTINCT `invoices`) 
  FROM `data` 
  WHERE date BETWEEN '2013-07-01' AND '2014-06-30' 
  GROUP BY `store`
  </code></pre>
  
  <p>I have made indexes on invoices, date, store and invoices, store, date. Any help is appreciated.</p>