title: Testing for Performance in Multiple SQL Queries
body: <p>I'm working to improve the efficiency of some SQL Queries on SQL-Server-2008.  There are different ways of performing each query and I want to find the fastest of them.  </p>
  
  <p>However, the issue that I'm having  is that I am having trouble determining which is actually executing faster.  Ideally I could just run each query one after the other and see which runs fastest.  Ideally...</p>
  
  <p>Problem is, is that SQL is too smart for my liking.  When constructing these queries I run them multiple times.  When I do this, the queries' efficiencies improve on their own.  This I would imaged is because of some behind-the-scenes stuff that SQL does.  What is this?  How can I avoid it?</p>
  
  <p>For example, I run the query once and it takes 30s.  I run it again and it takes 10s.  The more I run the query the faster it seems to run.  </p>
  
  <p>So.. Is there any way of "clearing the cache" or whatever the equivalent would be in SQL?  I want to get an accurate indication of which query is going to actually run faster.  Alternatively, what would be the best way to do the type of testing that I want?</p>
  
  <p>Any information in regards to this topic would be accepted as valid input.</p>