“WITH RECOMPILE"的任何缺点对于每月 SQL Server 存储过程进程? [英] Any downside to "WITH RECOMPILE" for monthly SQL Server stored proc processes?
本文介绍了“WITH RECOMPILE"的任何缺点对于每月 SQL Server 存储过程进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我认为这个问题说明了一切.我在存储过程中有几个每月的流程,这些流程需要一分钟到一小时的时间.如果我声明它们WITH RECOMPILE
,每次都会生成一个执行计划.
I think the question says it all. I have several monthly processes in stored procedures which take anywhere from a minute to an hour. If I declare them WITH RECOMPILE
, an execution plan will be generated each time.
如果 DBA 更改了基础索引或统计数据或视图,我不希望任何人必须进入并使用 ALTER 或其他任何内容强制重新编译 SP.
If the underlying indexes or statistics or views are changed by the DBA, I don't want anyone to have to go in and force a recompile the SPs with an ALTER or whatever.
这有什么缺点吗?
推荐答案
在这种情况下,这将是完全无害的,而且可能是一个好主意.
Under the circumstances, it would be completely harmless, and probably a good idea.
这篇关于“WITH RECOMPILE"的任何缺点对于每月 SQL Server 存储过程进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文