SQL Server Query is faster in SSMS when including execution plan?

Sounds a bit odd to me tbh. Are you sure that the difference you're seeing is not down to caching? I would always test the performance of a sproc by NOT including the execution plan, and I would clear the cache down before each run in order to have a fair comparison (on a test/dev db server, not production).

Sounds a bit odd to me tbh. Are you sure that the difference you're seeing is not down to caching? I would always test the performance of a sproc by NOT including the execution plan, and I would clear the cache down before each run in order to have a fair comparison (on a test/dev db server, not production).

DBCC FREEPROCCACHE -- will clear the execution plan cache DBCC DROPCLEANBUFFERS -- will clear the data cache.

When I run DBCC DROPFREEBUFFERS I get an error -- Incorrect DBCC statement. When I google it the command DBCC DROPCLEANBUFFERS comes up. – Chris Mullins Oct 22 '10 at 12:39 @Chris - sorry, typo!

Corrected now – AdaTheDev Oct 22 '10 at 12:41 Well I tested it with DBCC FREEPROCCACHE and DBCC DROPCLEANBUFFERS commands before the statement, and it is still faster with the Show Execution Plan on. I wonder if it has something to do with statistics, and if so how I can get the faster set of results when I run the query in production. – Chris Mullins Oct 22 '10 at 12:44 I am going to mark your answer as correct.

Although I still don't understand why it happens, it is probably a bug in the way the client statistics are counted, maybe they don't include the time for creating the execution plan when the execution plan display is on, or something like that. Your tip about clearing the cache helps me get a good baseline on the total execution time between trys so thanks for that. – Chris Mullins Oct 22 '10 at 10:48.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions