This article is guided by: The trigger causes deadlock, the job is many and frequent, the use of the middle table, the large number of cursors, the design of the index is unreasonable, the transaction operation is frequent, the SQL statement design is unreasonable, will cause the query inefficient, affect the performance of the server. We can use SQL Server's own profiling Trace tool SQL Profiler to analyze the source of problems caused by database design and to do targeted processing; here's how SQL Server queries for high CPU-intensive SQL statements
SQL Server queries for high CPU usage, sys.sysprocesses, dm_exec_sessions, dm_exec_requests
First, to see how many current database user connections are
Use master
GO
SELECT * FROM Sys. [sysprocesses] WHERE [spid]>50--and db_name ([dbid]) = ' Gposdb '
SELECT COUNT (*) from [SYS]. [Dm_exec_sessions] WHERE [session_id]>50
Second, select the first 10 most CPU-consuming sessions
SQL CodeCopy
Iii. Query the top 10 CPU-consuming SQL statements
SQL CodeCopy
Iv. How many workers are waiting in a query session
SQL CodeCopy
V. Querying high CPU-intensive statements
SQL CodeCopy
"Reprint" SQL Server queries for high CPU-intensive SQL statements