title: Selecting distinct date (not time) from a very large table with datetimes
body: <p>I have a large table I have been playing with the query analyzer and looking for the best way to do this. </p>
  
  <p>The table is like this: </p>
  
  <pre><code>name         rows        reserved     data         index_size   unused
  table_name   110980132   7802944 KB   6119784 KB   1679320 KB   3840 KB
  </code></pre>
  
  <p>And has these columns:</p>
  
  <pre><code> ID int, time_stamp datetime, value1 float, value2 float, value3 float.... 
  </code></pre>
  
  <p>These <code>time_stamps</code> are dates with times. I need to find an easy way, without storing anything, to be able to get just the date portions for the table. Eventually, I may need to know just the day + hour part (and not the whole time portion). At the moment, I just need to know what the last 30 days we had data for are (sometimes days are missing at this point, this question/query will ultimately not just be looking for the last x days, but all the days, or whatever).  </p>
  
  <p>What is the best way to do this considering performance and time? I've played with <code>group by</code>, <code>distinct</code>, <code>top x</code>, <code>rank()</code>, temp tables, views... some things are better than others but nothing I am doing seems to be great. </p>
  
  <p>Ideas? Thanks!</p>