Finding execution plan of executing query
If you have ever had a query that won’t run to completion, try this…
Captured to protect the information and as personal quick reference from Viewing the Execution Plan of a Running Query in SQL Server
- From SSMS find the session id of interest
- SELECT plan_handle FROM sys.dm_exec_requests WHERE session_id = {sessionid}
- SELECT query_plan FROM sys.dm_exec_query_plan (0x06001D009FE38431400399D4000000000000000000000000);
- Save the results as from above as .sqlplan and then open the file in management studio
There you go! Job saver!