title: How do you fix queries that only run slow until they're cached
body: <p>I have some queries that are causing timeouts in our live environment. (>30 seconds)</p>
  
  <p>If I run profiler and grab the exact SQL being run and run it from Management Studio then they take a long time to run the first time and then drop to a few hundred miliseconds each run after that.</p>
  
  <p>This is obviously SQL caching the data and getting it all in memory.</p>
  
  <p>I'm sure there are optimisations that can be made to the SQL that will make it run faster.</p>
  
  <p>My question is, how can I "fix" these queries when the second time I run it the data has already been cached and is fast?</p>