Reputation: 25213
How do I get the execution plans for a Stored Procedure?
Upvotes: 1
Views: 1503
Reputation: 294197
From SQL Server Management Studio check the 'Include Actual Execution Plan' option in the toolbar, then execute the procedure, see Displaying Graphical Execution Plans (SQL Server Management Studio).
or Run SET SHOWPLAN_XML ON;
then execute the procedure on the same connection, see Displaying Execution Plans by Using the Showplan SET Options (Transact-SQL).
or capture the Showplan XML Event Class in the Profiler see Displaying Execution Plans by Using SQL Server Profiler Event Classes.
Upvotes: 4
Reputation: 50215
In SQL Server 2005, just type up the EXEC YourProc
statement and hit Ctrl-L
.
An alternative is to "edit" the stored proc by commenting out the SP definition parts, defining the parameters as local variables, and Displaying the Estimated Execution Plan (Ctrl-L
).
Upvotes: 1
Reputation: 8016
If you're using MS Query Analyizer then there's a button you can click up on the tool bar. If I remember correctly (MS QA not installed on this PC) then it looks like a speech bubble with some green or blue chart marks on it?
Upvotes: 0