title: How to test MySQL query speed, with less inconsistencies?
body: <p>I need a simple way to test SQL queries for speed. I am not to worried about hardware differences, I basically need a relative number.</p>
  
  <p>This is what I've been doing with PHP (its fuzzy, but works): </p>
  
  <pre><code>// CONNECT TO DB HERE
  
  $sub = new YomoSubscription(95,783);
  
  $t = microtime(TRUE);
  
  // contains the SQL db call i'm testing
  $fp = $sub-&gt;generateFingerprint(); 
  
  echo microtime(TRUE)-$t;
  </code></pre>
  
  <p>The <b>PROBLEM</b> I am having is that, sometimes on initial connect/run my test takes 1.25 sec for example. However on subsequent connects it takes 0.004 sec ... <b>Why is this</b>?</p>
  
  <p>I'm pretty sure MySQL query cache is off in my.ini:</p>
  
  <pre><code>query_cache_size=0
  </code></pre>