Вы находитесь на странице: 1из 1

Sys.

dm_exec_query_planisadynamicmanagementfunctionwhichacceptstheplanhandleparameterand
displaystheestimatedexecutionplanfromtheplancache.Rememberthisonlyshowsestimatedplanandnot
theactualplan.Togettheactualplanyoucanuseextendedeventsoraddshowplanoptionstoyoursession.A
newDMVisintroducedinSQL2014,whichIamgoingtocoverlaterinthisseries,whichgivemostofthe
actualplanrelateddetails.
Toseetheoutputofsys.dm_exec_query_planletusruntheprocedurewhichIcreatedyesterday(refer
sys.dm_exec_sql_text).Whiletheprocedureisexecutinginsession52(thismaychangeinyourcase)runthe
belowquerytogettheplan.Remembertorunthisquerywithin10secondsafteryouruntheprocedure.
1
2
3
4
5

SELECTer.session_id,est.text,eqp.query_plan
FROMsys.dm_exec_requestser
CROSSAPPLYsys.dm_exec_sql_text(er.sql_handle)est
CROSSAPPLYsys.dm_exec_query_plan(er.plan_handle)
WHEREsession_id=52

Fromtheaboveoutputofsys.dm_exec_query_planwecanseetheestimatedexecutionplanfromtheplan
cache.Thiswillbeanxmllink.Onceyouclickyoucanconfirmtheplantobeestimatedonefromthebelow
screenshot.

Вам также может понравиться