开发者

How to bypass SQL Server caching

When I am trying to examine the performance of a given query in my application I'm generally uninterested in the effect my code is having. I want to be able to watch the time taken in Sql Man开发者_JAVA技巧agement Studio.

Unfortunately, I'm finding that some sort of caching must be going on, because one query that returns 10,000 results from a table with 26 or so columns, many of them large varchars, takes 12 seconds the first time I run it in a while and takes 6 seconds the following times unless I don't re-run it for a few minutes.

Is there any way to instruct it to bypass the cache and pretend like it had never run it before? I'm using SQL Server 10.0.


You can clean out the cache and sproc cache with

DBCC DROPCLEANBUFFERS
DBCC FREEPROCCACHE

respectively

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜