title: SQL query performance and dropcleanbuffers
body: <p>There is a "best practice" that you have to run</p>
  
  <pre><code>DBCC FREESESSIONCACHE
  DBCC FREEPROCCACHE
  DBCC DROPCLEANBUFFERS
  </code></pre>
  
  <p>Before doing performance analysis on a SQL query.</p>
  
  <p>Yet, for example, the later one DROPCLEANBUFFERS:</p>
  
  <blockquote>
    <p>Use DBCC DROPCLEANBUFFERS to test queries with a cold buffer cache
    without shutting down and restarting the server.</p>
    
    <p>To drop clean buffers from the buffer pool, first use CHECKPOINT to
    produce a cold buffer cache. This forces all dirty pages for the
    current database to be written to disk and cleans the buffers. After
    you do this, you can issue DBCC DROPCLEANBUFFERS command to remove all
    buffers from the buffer pool.</p>
  </blockquote>
  
  <p>I guess, this means that you will test your query as if it was the first query that has run in the server, thus the actual "real-life" impact of the query will be lower.</p>
  
  <p>Is it really advisable to run the three commands to know the query cost or does it get you to a rather empirical results that have no close relation to actual query time in live environment?</p>