How do I view a stored procedure execution plan in SQL Server?

How do I view a stored procedure execution plan in SQL Server?

9 Answers. Select the storedprocedure name (just type it in a query window), right click, and choose the ‘Display Estimated Execution Plan’ button in the toolbar of SQl Server Mgmt Studio. Note that you don’t have to have the stored procedure code open.

How do I view the content of a stored procedure?

To view the definition a procedure in Object Explorer

  1. In Object Explorer, connect to an instance of Database Engine and then expand that instance.
  2. Expand Databases, expand the database in which the procedure belongs, and then expand Programmability.

How to obtain the execution plan for a stored procedure?

If you are trying to obtain the execution plan for statements in a stored procedure then you should execute the stored procedure, like so: When your query completes you should see an extra tab entitled “Execution plan” appear in the results pane. If you ran many statements then you may see many plans displayed in this tab.

How to define a stored procedure in SQL?

On the toolbar, click New Query. In the query window, enter the following statements that use the OBJECT_DEFINITION system function. Change the database name and stored procedure name to reference the database and stored procedure that you want. In Object Explorer, connect to an instance of the Database Engine. On the toolbar, click New Query.

Where to find query plan in SQL Server?

If you click on the query plan link within the results, a new tab will open with the graphical plan: As with a plan you view normally in SQL Server Management Studio or another tool, you can hover over any steps to get more details, or open the properties window for even more information.

How to view the execution plan in SQL Server?

There are several methods available for viewing a query plan in SQL Server The Actual execution plan option is available in the in the Home tab of ApexSQL Plan If multiple SQL queries are executed, their plans will be listed in the same tab, one below another separated as statements.