title: Which is fastest? SELECT SQL_CALC_FOUND_ROWS FROM `table`, or SELECT COUNT(*)
body: <p>When you limit the number of rows to be returned by a SQL query, usually used in paging, there are two methods to determine the total number of records:</p>
  
  <h3>Method 1</h3>
  
  <p>Include the <code>SQL_CALC_FOUND_ROWS</code> option in the original <code>SELECT</code>, and then get the total number of rows by running <code>SELECT FOUND_ROWS()</code>:</p>
  
  <pre><code>SELECT SQL_CALC_FOUND_ROWS * FROM table WHERE id &gt; 100 LIMIT 10;
  SELECT FOUND_ROWS();  
  </code></pre>
  
  <h3>Method 2</h3>
  
  <p>Run the query normally, and then get the total number of rows by running <code>SELECT COUNT(*)</code></p>
  
  <pre><code>SELECT * FROM table WHERE id &gt; 100 LIMIT 10;
  SELECT COUNT(*) FROM table WHERE id &gt; 100;  
  </code></pre>
  
  <p><strong>Which method is the best / fastest?</strong></p>