title: Mysql big table with datetime column
body: <p>What is the best thing for my scenario</p>
  
  <p>I have a tables with nearly 20,000,000 records, which basically stores what users have done in the site</p>
  
  <ul>
  <li><code>id</code> -> primary int 11 auto increment </li>
  <li><code>user_id</code> -> index int 11 not null</li>
  <li><code>create_date</code> -> ( no index yet ) date-time not null</li>
  <li>it has other columns but seems irrelevant to name them here</li>
  </ul>
  
  <p>I know I must put an index on create_date but do I put a single column index or a double column, which one first on the double index ( given the large number of records)?</p>
  
  <p>by the way the query that I'm now using is like :</p>
  
  <pre><code>select max(id) -- in here I'm selecting actions that users have done, after this date, since date is today
  from table t
  where 
      t.create_date &gt;= '2014-12-29 00:00:00'
  group by t.user_id
  </code></pre>