title: Best way to test if a row exists in a MySQL table
body: <p>I'm trying to find out if a row exists in a table. Using MySQL, is it better to do a query like this:</p>
  
  <pre><code>SELECT COUNT(*) AS total FROM table1 WHERE ...
  </code></pre>
  
  <p>and check to see if the total is non-zero or is it better to do a query like this:</p>
  
  <pre><code>SELECT * FROM table1 WHERE ... LIMIT 1
  </code></pre>
  
  <p>and check to see if any rows were returned?</p>
  
  <p>In both queries, the WHERE clause uses an index.</p>