title: MySQL fastest way to search by DATE if a record exist
body: <p>I have found many way to search a mysql record by DATE</p>
  
  <p><strong>Method 1:</strong></p>
  
  <pre><code>SELECT id FROM table WHERE datetime LIKE '2015-01-01%' LIMIT 1
  </code></pre>
  
  <p><strong>Method 2 (same as method 1 + ORDER BY):</strong></p>
  
  <pre><code>SELECT id FROM table WHERE datetime LIKE '2015-01-01%' ORDER BY datetime DESC LIMIT 1
  </code></pre>
  
  <p><strong>Method 3:</strong></p>
  
  <pre><code>SELECT id FROM table WHERE datetime BETWEEN '2015-01-01' AND '2015-01-01 23:59:59' LIMIT 1
  </code></pre>
  
  <p><strong>Method 4:</strong></p>
  
  <pre><code>SELECT id FROM table WHERE DATE_FORMAT( datetime, '%y.%m.%d' ) = DATE_FORMAT( '2015-01-01', '%y.%m.%d' )
  </code></pre>
  
  <p><strong>Method 5 (I think is the slowest):</strong></p>
  
  <pre><code>SELECT id FROM table WHERE DATE(`datetime`) = '2015-01-01' LIMIT 1
  </code></pre>
  
  <p>What is the fastest?</p>
  
  <p>In my case the table has 1 million rows, and the date to search is always recent.</p>