Generating and Saving Execution Plans in SQL Server Management Studio
Before and after the execution of the query, the execution plans in SQL Server. Actual and estimated execution plans can be achieved by the given steps:
Generation of Actual Execution Plans
The actual execution plan can be achieved in the following ways in SQL Server:
- After completely writing the query, Press Ctrl+M, and the actual execution plan will be generated.
- Go to the query window and right-click on it, then click on the context menu and select ‘Display Actual Execution Plan’.
- Or the ‘Display Actual Execution Plan’ icon can be directly selected from the toolbar.
Generation of Estimated Execution Plans
An estimated execution plan can be achieved using the following ways in SQL Server:
- After completely writing the query, Press Ctrl+L, and the plan will be generated.
- Go to the query window and right-click on it, then click on the context menu and select “Display Estimated Execution Plan“.
- Or the “Display Estimated Execution Plan” icon can be directly selected from the toolbar.
Query Execution Plan in SQL
A query execution plan (also known as a query plan) is a sequence of steps used by a relational database management system (RDBMS) to access data efficiently when executing a query. The query plan is also referred to as the SQL Server execution plan.
The query optimizer generates the SQL Server execution plan or query plan. Its goal is to generate an optimal economic query plan. Multiple execution plans are generated by the query processing engine after query execution, and from those generated execution plans, a plan with the best performance is selected.
The execution plans are stored in the plan cache memory location, from where they can be reused. Execution plans are available in 3 forms in the SQL server: XML plans, Graphical plans, and Text plans.
Here, we will learn all about Query-Execution Plans in SQL, understand the types of query execution plans, how to create query plans, and at last how to save query plans in SQL Server.
Contact Us