Skip to content

Commit 04e0c9a

Browse files
authored
minor ms style corrections
1 parent 57a0278 commit 04e0c9a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

articles/mysql/single-server/how-to-troubleshoot-high-cpu-utilization.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Besides capturing metrics, it’s important to also trace the workload to unders
2525

2626
CPU spikes can occur for various reasons, primarily due to spikes in connections and poorly written SQL queries, or a combination of both:
2727

28-
**Spike in Connections**
28+
#### Spike in connections
2929

3030
An increase in connections can lead to an increase in threads, which in turn can cause a rise in CPU usage as it has to manage these connections along with their queries and resources. To troubleshoot a spike in connections, you should check the [Total Connections](./../flexible-server/concepts-monitoring.md#list-of-metrics) metric and refer to the next section for more details about these connections. You can utilize the performance_schema to identify the hosts and users currently connected to the server with the following commands:
3131

@@ -35,16 +35,17 @@ Current connected hosts
3535
where CURRENT_CONNECTIONS > 0
3636
and host not in ('NULL','localhost');
3737
```
38+
3839
Current connected users
3940
```
4041
select USER,CURRENT_CONNECTIONS from performance_schema.users
4142
where CURRENT_CONNECTIONS >0
4243
and USER not in ('NULL','azure_superuser');
4344
```
4445

45-
**Poorly Written SQL Queries**
46+
#### Poorly written SQL queries
4647

47-
Queries that are expensive to execute and scan a large number of rows without an index, or those that perform temporary sorts along with other inefficient plans, can lead to CPU spikes. While some queries may execute quickly in a single session, they can cause CPU spikes when run in multiple sessions. Therefore, it’s crucial to always explain your queries that you capture from the [show processlist](https://dev.mysql.com/doc/refman/5.7/en/show-processlist.html) and ensure their execution plans are efficient. This can be achieved by ensuring they scan a minimal number of rows by using filters/where cluase, utilize indexes and avoid using large temporary sort along with other bad execution plans. You can find more information about execution plans [here](https://dev.mysql.com/doc/refman/5.7/en/explain-output.html).
48+
Queries that are expensive to execute and scan a large number of rows without an index, or those that perform temporary sorts along with other inefficient plans, can lead to CPU spikes. While some queries may execute quickly in a single session, they can cause CPU spikes when run in multiple sessions. Therefore, it’s crucial to always explain your queries that you capture from the [show processlist](https://dev.mysql.com/doc/refman/5.7/en/show-processlist.html) and ensure their execution plans are efficient. This can be achieved by ensuring they scan a minimal number of rows by using filters/where cluase, utilize indexes and avoid using large temporary sort along with other bad execution plans. For more information about execution plans, see [EXPLAIN Output Format](https://dev.mysql.com/doc/refman/5.7/en/explain-output.html).
4849

4950
## Capturing details of the current workload
5051

0 commit comments

Comments
 (0)