如何显示存储过程的执行计划? [英] How can I display the execution plan for a stored procedure?
问题描述
我能够查看查询的估计执行计划(Management Studio 9.0),没有问题,但是对于存储过程,如果不从ALTER屏幕复制代码并粘贴,就看不到一种简单的方法来执行此操作.将其输入查询窗口,否则将显示ALTER的计划,而不显示过程.即使执行了此操作,也缺少任何输入,因此我需要对它们进行DECLARE.
I am able to view the Estimated Execution Plan (Management Studio 9.0) for a query without a problem but when it comes to stored procedures I do not see an easy way to do this without copying the code from the ALTER screen and pasting it into a query window, otherwise it will show the plan for the ALTER and not the procedure. Even after doing this, any inputs are missing and I would need to DECLARE them as such.
在存储过程中有更简单的方法吗?
Is there an easier way to do this on stored procedures?
修改: 我只是想到了可能有用的方法,但不确定.
I just thought of something that might work but I am not sure.
我可以制定估计的执行计划吗
Could I do the estimated execution plan on
exec myStoredProc 234
推荐答案
SET SHOWPLAN_ALL ON
GO
-- FMTONLY will not exec stored proc
SET FMTONLY ON
GO
exec yourproc
GO
SET FMTONLY OFF
GO
SET SHOWPLAN_ALL OFF
GO
这篇关于如何显示存储过程的执行计划?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!