问题描述
我有一个针对 SQL Server 2005 运行的简单查询
I've got a simple query running against SQL Server 2005
SELECT *
FROM Table
WHERE Col = 'someval'
第一次执行查询可以取>15 秒.后续执行返回 <1 秒.
The first time I execute the query can take > 15 secs. Subsequent executes are back in < 1 sec.
如何让 SQL Server 2005 不使用任何缓存结果?我试过跑步
How can I get SQL Server 2005 not to use any cached results? I've tried running
DBCC DROPCLEANBUFFERS
DBCC FREEPROCCACHE
但这似乎对查询速度没有影响(仍然是<1 sec).
But this seems to have no effect on the query speed (still < 1 sec).
推荐答案
这里有一些很好的解释.看看吧.
Here is some good explaination. check out it.
http://www.mssqltips.com/tip.asp?tip=1360
CHECKPOINT;
GO
DBCC DROPCLEANBUFFERS;
GO
来自链接的文章:
如果所有性能测试都在 SQL Server 中进行,最好的方法可能是发出 CHECKPOINT,然后发出 DBCC DROPCLEANBUFFERS 命令.尽管 CHECKPOINT 进程是 SQL Server 中的一个自动内部系统进程并且定期发生,但发出此命令以将当前数据库的所有脏页写入磁盘并清理缓冲区非常重要.然后可以执行 DBCC DROPCLEANBUFFERS 命令从缓冲池中删除所有缓冲区.
If all of the performance testing is conducted in SQL Server the best approach may be to issue a CHECKPOINT and then issue the DBCC DROPCLEANBUFFERS command. Although the CHECKPOINT process is an automatic internal system process in SQL Server and occurs on a regular basis, it is important to issue this command to write all of the dirty pages for the current database to disk and clean the buffers. Then the DBCC DROPCLEANBUFFERS command can be executed to remove all buffers from the buffer pool.
这篇关于如何清除 SQL Server 查询缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)