重置执行计划 [英] Resetting Execution Plans

查看:50
本文介绍了重置执行计划的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在优化一个查询,并且担心 SQL Server 正在缓存执行计划,所以想清除它们.

I am optimizing a query and am worried that SQL Server is caching execution plans so want to wipe them.

我该怎么做?

推荐答案

你应该这样做:DBCC FREEPROCCACHE;

我也这样做DBCC DROPCLEANBUFFERS

使用 DBCC DROPCLEANBUFFERS 测试带有冷缓冲区缓存的查询无需关闭并重新启动服务器.

Use DBCC DROPCLEANBUFFERS to test queries with a cold buffer cache without shutting down and restarting the server.

要从缓冲池中删除干净的缓冲区,首先使用 CHECKPOINT产生冷缓冲区缓存.这会强制所有脏页当前要写入磁盘并清理缓冲区的数据库.之后你这样做,你可以发出 DBCC DROPCLEANBUFFERS 命令来删除所有缓冲池中的缓冲区.

To drop clean buffers from the buffer pool, first use CHECKPOINT to produce a cold buffer cache. This forces all dirty pages for the current database to be written to disk and cleans the buffers. After you do this, you can issue DBCC DROPCLEANBUFFERS command to remove all buffers from the buffer pool.

这篇关于重置执行计划的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆