What Is An Execution Plan In SQL Server: Learn All About It

Andrew Jackson | January 10th, 2017 | SQL

An execution plan in the SQL server is arranged set of steps whose purpose is to operate and alter data in SQL RDBMS. It acts as a road map, which records and displays a data retrieval solution that is selected by the server query optimizer. This optimizer stores overall procedure of query and is quite useful utility for the one who clearly understands the query performance and characteristics. Well, the query execution plan is also termed as Explain Plan statement that is showing predefined execution schema (selected by an optimizer) for Update, Insert, Select, and delete statements. In general, an Execution Plan is the sequence of activities, which Oracle does for execution of each query.

More About Execution Plan In SQL Server

In order to view execution plan in SQL server 2012 or any other version, there are some prerequisites to be fulfilled before watching it and they are as followed:

  • Enable feature to show plan in the database.
  • A user should be the Sysadmin of the Server.
  • An end user must be owner of the database.

A complete set of the server process starts their functioning when the server user executes a query in the SQL server database management system. The aim of this process set is to manage a system in such a way that it provides data back to the entity, who is executing that particular query. It maintains the record in a time-to-time manner and ensures integrity of data throughout the procedure. Moreover, an installed database management system on the machine might offer a one or more mechanisms to return plan of a provided query. These mechanisms provide different views to learn about a plan, which enable one to see execution plan in any of the following layout:

  • Graphical Plans
  • Textual Plans
  • XML Plans

Depending upon the understandings and requirements, one can choose any one of the three layout for viewing data.

Types of Execution Plan In SQL Server

In general, there are following two execution plans in the SQL relational database management system. Although both these type of execution plans are having similar graphical representation, but they cannot be same in some case.

Actual Execution Plan (AEP): This type of plan is created after complete execution of the server query, which comprises of all steps performed while working. One can display this plan as a set of results either by pressing Ctrl+M or by clicking on AEP icon.

Estimated Execution Plan (EEP): The creation of this type of plan is not dependent upon execution of any query. Basically, it already comprises of an approx execution plan, which is used while completion of execution procedure. Users can see this plan either by pressing Ctrl+L keys in query window of the server or click on EEP icon (available in management studio)

Note: Both these type of plans are also provided in Query menu of SQL server management studio.

execution plan

SQL Server Query Execution Plan Analysis

In this section, one is going to find different ways (in different scenarios) to analyze the performance of a query with help of the Execution Plan. It outlines that how a query optimizer of the server actually executed (or ran) a specific query. This will help clients to learn the reason due to which query is running slow. There are various ways to find out an execution plan of the query and some of them are mentioned-below:

Following Execution Plan: In this type, one can consider this as warning signs and then investigate them to examine reason of slow down. From performance perspective, each of them are quite less than ideal ones.

Complex Graphical Plan: It is not worth for every user that they are feasible with graphical layout of execution plan. In addition, the output of this plan is not easy to read and understand. Therefore, to resolve this issue one have to split processes, which optimizer has to perform for final execution.

SQL Server Profiler: It is an interface, which is used to create and manage traces along with its result. This utility is also used to analyze the performance of the server query, which means that events can be later be analyzed with help of this profiler.

Observational Verdict

What is an execution plan in SQL Server is now no more a question mark for end users. This blog illustrates all the detail about this server plan along with its type and importance. In addition, an overview to the alternative solution for analyzing the server query is also mentioned.