如何显示存储过程的执行计划? [英] How can I display the execution plan for a stored procedure?

查看:72
本文介绍了如何显示存储过程的执行计划?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够查看查询的估计执行计划(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屋!

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