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

  1. From SSMS find the session id of interest
  2. SELECT plan_handle FROM sys.dm_exec_requests WHERE session_id = {sessionid}
  3. SELECT query_plan FROM sys.dm_exec_query_plan (0x06001D009FE38431400399D4000000000000000000000000);
  4. Save the results as from above as .sqlplan and then open the file in management studio

There you go! Job saver!