title: What is the most efficient way to search in date ranges in MySQL?
body: <p>I'd like to ask what is the most efficient (and fastest) way to search for data between 2 dates?</p>
  
  <p>Let's consider having following simple query:</p>
  
  <pre><code>SELECT Date_,counter1,counter2,...
  WHERE (date range condition)
  </code></pre>
  
  <p>The "Date_" column is a DATETIME type.</p>
  
  <p>I tried different options like:</p>
  
  <pre><code>WHERE Date_ &gt;= '2012-12-01 00:00:00' AND Date_ &lt;= '2012-12-05 00:00:00'
  </code></pre>
  
  <p>and</p>
  
  <pre><code>WHERE Date_ BETWEEN '2012-12-01 00:00:00' AND '2012-12-05 00:00:00'
  </code></pre>
  
  <p>and</p>
  
  <pre><code>WHERE Date_ = '2012-12-01 00:00:00' OR Date_ = '2012-12-02 00:00:00' OR
  Date_ = '2012-12-03 00:00:00' OR Date_ = '2012-12-04 00:00:00' OR
  Date_ = '2012-12-05 00:00:00'
  </code></pre>
  
  <p>In fact this Select query is a lot more complicated (with joins and more conditions). This is only the simplified version. According to EXPLAIN there is no difference, how the query is executed. I need to say that Date_ column is indexed. Unfortunately, I cannot test the real query speed, because I cannot avoid OS caching, but at least MySQL cache was not used (SQL_NO_CACHE).</p>
  
  <p><strong>Is there according to your experince a faster way to search in date intervals (without functions)?</strong></p>
  
  <p><strong>Which of the three methods is faster (in case that there is a difference at all)?</strong></p>
  
  <p>Thanks a lot in advance!</p>