• Whether or not you clear the buffers or the cache before you measure performance really comes down to what you're trying to measure. I agree with Kevin that most queries, most of the time, are working on active memory, so the added measure of reading from disk doesn't really do much. In fact, most of the time, when testing queries, I'll run it once without really looking at the time, then run it 2-3 more times and take the average run time. That way I get the compile and loading from disk out of the way and I'm just seeing the time it takes to actually execute the query. But, it does depend on what you're trying to measure.

    As to measuring that inner query separately, I'd just run that select as a different statement if I really wanted to measure it. And, of course, check the execution plan to see how the query is being resolved.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning