title: Mysql speed up max() group by
body: <p>I have an easy query for grouping rows which takes 0.0045 sec. for 300.000 rows</p>
  
  <p><code>SELECT cid FROM table GROUP BY cid</code></p>
  
  <p>When I add MAX() to query it takes 0.65 sec to return.</p>
  
  <p><code>SELECT MAX(id) id, cid FROM table GROUP BY cid</code></p>
  
  <p>How can I speed up this query? The query runs on my local host for testing. id = primary key and I have index on cid.</p>