title: What does "SELECT /*!N SQL_NO_CACHE */ * FROM `mytable`" mean in in MySQL's slow query log?
body: <p>I've just turned on <a href="http://dev.mysql.com/doc/refman/5.1/en/slow-query-log.html">slow query logging</a> on my MySQL database, adding the following to <code>/etc/mysql/my.cnf</code>:</p>
  
  <pre><code>log_slow_queries = /var/log/mysql/mysql-slow.log
  long_query_time = 1
  </code></pre>
  
  <p>When I run <a href="http://dev.mysql.com/doc/refman/5.1/en/mysqldumpslow.html">mysqldumpslow</a>, it outputs the following:</p>
  
  <pre><code>Reading mysql slow query log from mysql-slow.log
  Count: 1  Time=199.23s (199s)  Lock=0.00s (0s)  Rows=32513.0 (32513), ...
   SELECT /*!N SQL_NO_CACHE */ * FROM `mytable`
  
  ...
  </code></pre>
  
  <p>Looking at the original <code>mysql-slow.log</code>, the full query was:</p>
  
  <pre><code>SELECT /*!40001 SQL_NO_CACHE */ * FROM `mytable`;
  </code></pre>
  
  <p>So <code>mysqldumpslow</code> just replaced the number with <code>N</code> (to assist aggregating similar queries.)</p>
  
  <p>So, the question is, where does that query come from and what does the <code>/*!40001 SQL_NO_CACHE */</code> bit mean?</p>
  
  <p>As best I can tell, it's probably from a <code>mysqldump</code> command that was doing a backup (hence not wanting cached data), does that seem right? And if so, since it only read 32,000 rows, why did it take 199s?</p>
  
  <p>There are a bunch more similar queries on other tables taking 100s, 50s, down to a more reasonable 3s, most having about 10-20,000 rows, the biggest with 450,000 rows.</p>