Sometimes a query will be taking ages and you don't want to have to run the whole thing. This is exactly the kind of time you may want to see the Actual Execution Plan to figure out why the query is inefficient. However I've noticed that when you tell SSMS to include the Actual Execution Plan in the results, it only does so when the query finishes successfully and is not cancelled! Why is this? Presumably the plan has to be generated first, so it could be sent first by SQL Server and be displayed even for a cancelled query. I know about the estimated execution plan but it's not the same.
SQL Server – How to Get Actual Execution Plan for Cancelled Query
execution-plansql serversql server 2014ssms
Related Question
- SQL Server – Estimated Plan Generation Succeeds for Batch Creating and Using #temp Table but Fails with Permanent Table
- SQL Server – Query Plan Estimated Cost vs dm_exec_query_stats Worker Time
- SQL Server 2014 SP3 – Unable to Get Actual Execution Plan
- SQL Server – How to See Candidate Execution Plans Generated by Query Optimizer
- Sql-server – SQL extended event captured only the estimated execution plan but no actual execution plan
- Sql-server – Adding an INNER JOIN ruins query performance due to different execution plan despite updated STATISTICS and RECOMPILE, why
Best Answer
In SQL Server 2016 Management studio you can see the execution plan while executing, using the include live execution plan. This works for SQL Server 2014+
For SQL Server 2014 I usually use this query to get the execution plan of execution query's
This gets the statement executing with their corresponding estimated query plan.