In another question I was trying to research how to control SQL Server's query plan caches:
https://stackoverflow.com/questions/2593749/is-there-an-equivalent-of-optionrecompile-or-with-recompile-for-an-entire-c
...and I found trace flag 253 via this article:
http://www.sqlservercentral.com/Forums/Topic837613-146-1.aspx
The article is correct, if I run DBCC TRACEON(2开发者_运维问答53) and then a number of queries, I can manually check the query plan cache and see that plans have not been inserted. If I run DBCC TRACEOFF(253), query plans are cached as normal.
So my question is...what else does this flag do? Does anybody know the official story?
As you say and as is mentioned in Jon Seigels comment, it:
Prevents ad-hoc query plans to stay in cache.
It shouldn't do anything else. However, as is also stated here for trace flags, generally:
Trace flags cause the database engine to execute alternate code paths that may not have been as rigorously tested or have a specific purpose and may have side effects that are unpredictable.
Given this is info from a MVP who claims to have heard from a member of the product team, it looks to be as official as it gets. Especially since Microsofts own documentation on MSDN doesn't contain all trace flags that can be found on the net - like Jon Seigels link in his comment.
精彩评论