Quote:
Originally posted by chrisrlong
A couple of thoughts:
- When timing queries, there are so many variables - one of the most important of which is I/O. Run any statement twice and it will run faster the second time because data was read from disk the first time and put in cache. Therefore, the second run did not have to read that data from disk and ran much faster. Any time you are using actualy time to compare the efficiency of statements, you need to run *each* version enough times to eliminate caching as a variable. You must run each several times because, since they probably have different execution plans, they will be caching different data.
- Chris
Thanks Chris, yeah, I realise this, I actually ran the query a number of times after each other to take into account the caching from disk.