title: MySQL: Fastest way to count number of rows
body: <p>Which way to count a number of rows should be faster in MySQL?</p>
  
  <p>This:</p>
  
  <pre><code>SELECT COUNT(*) FROM ... WHERE ...
  </code></pre>
  
  <p>Or, the alternative:</p>
  
  <pre><code>SELECT 1 FROM ... WHERE ...
  
  // and then count the results with a built-in function, e.g. in PHP mysql_num_rows()
  </code></pre>
  
  <p>One would think that the first method should be faster, as this is clearly database territory and the database engine should be faster than anybody else when determining things like this internally.</p>