查询SQLServer的CPU占用率过高
1.查询CPU占用率较高的前10条数据(查询语句)
SELECT TOP 10
total_worker_time/execution_count AS avg_cpu_cost, plan_handle,
execution_count,
(SELECT SUBSTRING(text, statement_start_offset/2 + 1,
(CASE WHEN statement_end_offset = -1
THEN LEN(CONVERT(nvarchar(max), text)) * 2
ELSE statement_end_offset
END - statement_start_offset)/2)
FROM sys.dm_exec_sql_text(sql_handle)) AS query_text
FROM sys.dm_exec_query_stats
ORDER BY [avg_cpu_cost] DESC
2.建立SQL Server Profiler跟踪
感谢:https://jingyan.baidu.com/album/39810a239f92f9b636fda6a8.html?picindex=2
https://blog.csdn.net/cxzhq2002/article/details/47006367