![]() Inner join sys.dm_exec_cached_plans p on highest_cpu_an_handle = p.plan_handleĬROSS APPLY sys.dm_exec_sql_text(highest_cpu_an_handle) AS q , highest_cpu_queries.last_execution_timeįROM sys.dm_exec_procedure_stats AS highest_cpu_queries ,(highest_cpu_queries.total_worker_time/highest_cpu_queries.execution_count) AS AverageCPU SELECT WHEN q.dbid = 32767 then 'Resource' ELSE DB_NAME(q.dbid)END AS DBName Under what circumstances would we encounter such a situation.Please find the queries below - WITH Procedure Stats I can see the plan_handle of the proc in exec_cached_plans, but i don't see a sql_handle for it in dm_exec_query_stats. ![]() The results, I get less number of rows in SQL 2005. I have used the following script to achieve it. I am in the process of creating a script that would return the resource usage of stored procs in SQL 2005 as there is no "dm_exec_procedure_stats" DMV available in SQL 2005.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |