重置SQL Server执行计划
我已经查遍了这个命令......重置 SQL Server 执行计划的命令是什么?
I've looked all over for this command....what's the command to reset the SQL Server's execution plan?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
为了清楚起见......
执行
sp_recompile
将“标记”给定的存储过程进行重新编译,这将在下次执行时发生。使用
WITH RECOMPILE
选项将导致每次执行给定存储过程时生成一个新的执行计划。要清除整个过程缓存,请执行
For clarity..........
Executing
sp_recompile
will "mark" the given stored procedure for recompilation, which will occur the next time it is executed.Using the
WITH RECOMPILE
option will result in a new execution plan being generated each time the given stored procedure is executed.To clear the entire procedure cache execute
对于存储过程,您可以使用
WITH RECOMPILE
选项。For stored procedures, you use the
WITH RECOMPILE
option.如果要重置存储过程的 QEP,应使用
sp_recompile
If you want to reset QEP for a stored procedure, you shall use
sp_recompile
从你的问题中尚不完全清楚你所追求的是什么。但除了其他建议之外,DBCC FREEPROCCACHE 还会清除所有缓存的执行计划。
It's not entirely clear from your question what you're after. But in addition to the other suggestions, DBCC FREEPROCCACHE clears all cached execution plans.
sp_recompile 将转储现有查询计划并重新编译该过程。
或者您可以重新启动 SQL,这将清除整个执行计划缓存。
每次执行WITH RECOMPILE 都会生成一个新计划。
sp_recompile will dump the existing query plan and recompile the procedure.
Or you can restart SQL and that will clear the entire execution plan cache.
WITH RECOMPILE is going to generate a new plan EVERY time you execute it.