title: Stop MySQL after first match
body: <p>I noticed that adding <code>LIMIT 1</code> at the end of a query does not decrease the execution time. I have a few thousand records and a simple query. How do I make MySQL stop after the first match?</p>
  
  <p>For example, these two queries both take approximately half a second:</p>
  
  <pre><code>SELECT id,content FROM links WHERE LENGTH(content)&lt;500 ORDER BY likes
  
  SELECT id,content FROM links WHERE LENGTH(content)&lt;500 ORDER BY likes LIMIT 1
  </code></pre>
  
  <p><strong>Edit:</strong> And here's the explain results:</p>
  
  <pre><code>id | select_type | table | type possible_keys | key | key_len | ref | rows | Extra
  1 | SIMPLE | links | ALL | NULL | NULL | NULL | NULL | 38556 | Using where; Using filesort
  </code></pre>