|
1 | 1 | --- |
2 | 2 | title: Troubleshoot high-CPU-usage issues in SQL Server |
3 | 3 | description: This article provides a procedure to help you fix high-CPU-usage issues on a server that is running SQL Server. |
4 | | -ms.date: 01/25/2024 |
| 4 | +ms.date: 10/23/2024 |
5 | 5 | ms.custom: sap:SQL resource usage and configuration (CPU, Memory, Storage) |
6 | 6 | ms.topic: troubleshooting |
7 | 7 | ms.reviewer: jopilov, v-jayaramanp, v-sidong |
@@ -34,24 +34,28 @@ Use one of the following tools to check whether the SQL Server process is actual |
34 | 34 |
|
35 | 35 | - You can use the following PowerShell script to collect the counter data over a 60-second span: |
36 | 36 |
|
37 | | - ```powershell |
38 | | - $serverName = $env:COMPUTERNAME |
39 | | - $Counters = @( |
40 | | - ("\\$serverName" + "\Process(sqlservr*)\% User Time"), ("\\$serverName" + "\Process(sqlservr*)\% Privileged Time") |
41 | | - ) |
42 | | - Get-Counter -Counter $Counters -MaxSamples 30 | ForEach { |
43 | | - $_.CounterSamples | ForEach { |
44 | | - [pscustomobject]@{ |
45 | | - TimeStamp = $_.TimeStamp |
46 | | - Path = $_.Path |
47 | | - Value = ([Math]::Round($_.CookedValue, 3)) |
48 | | - } |
49 | | - Start-Sleep -s 2 |
50 | | - } |
51 | | - } |
52 | | - ``` |
53 | | -
|
54 | | -If `% User Time` is consistently greater than 90 percent (% User Time is the sum of processor time on each processor, its maximum value is 100% * (no of CPUs)), the SQL Server process is causing high CPU usage. However, if `% Privileged time` is consistently greater than 90 percent, your antivirus software, other drivers, or another OS component on the computer is contributing to high CPU usage. You should work with your system administrator to analyze the root cause of this behavior. |
| 37 | + ```powershell |
| 38 | + $serverName = $env:COMPUTERNAME |
| 39 | + $Counters = @( |
| 40 | + ("\\$serverName" + "\Process(sqlservr*)\% User Time"), ("\\$serverName" + "\Process(sqlservr*)\% Privileged Time") |
| 41 | + ) |
| 42 | + Get-Counter -Counter $Counters -MaxSamples 30 | ForEach { |
| 43 | + $_.CounterSamples | ForEach { |
| 44 | + [pscustomobject]@{ |
| 45 | + TimeStamp = $_.TimeStamp |
| 46 | + Path = $_.Path |
| 47 | + Value = ([Math]::Round($_.CookedValue, 3)) |
| 48 | + } |
| 49 | + Start-Sleep -s 2 |
| 50 | + } |
| 51 | + } |
| 52 | + ``` |
| 53 | + |
| 54 | + If `% User Time` is consistently greater than 90 percent (% User Time is the sum of processor time on each processor, its maximum value is 100% * (no of CPUs)), the SQL Server process is causing high CPU usage. However, if `% Privileged time` is consistently greater than 90 percent, your antivirus software, other drivers, or another OS component on the computer is contributing to high CPU usage. You should work with your system administrator to analyze the root cause of this behavior. |
| 55 | + |
| 56 | +- [Performance Dashboard](/sql/relational-databases/performance/performance-dashboard): In SQL Server Management Studio, right click **\<SQLServerInstance\>** and select **Reports** > **Standard Reports** > **Performance Dashboard**. |
| 57 | + |
| 58 | + The dashboard will illustrate a graph titled **System CPU Utilization** with a bar chart. The darker color indicates the SQL Server engine CPU utilization, while the lighter color represents the overall operating system CPU utilization (see the legend on the graph for reference). Select the circular refresh button or <kbd>F5</kbd> to see updated utilization. |
55 | 59 |
|
56 | 60 | ## Step 2: Identify queries contributing to CPU usage |
57 | 61 |
|
|
0 commit comments