Updated on 2025-12-26 GMT+08:00

High CPU Usage of RDS for MySQL Instances

If the CPU usage of your RDS for MySQL instance is high or close to 100%, database performance deteriorates. For example, data read/write becomes slow, connecting to the instance takes a longer time, or errors are reported when you are trying to delete data.

You are advised to enable SQL audit in advance so that you can view SQL execution records in audit logs to locate the fault when the CPU usage is high.

Solution

Analyze slow SQL logs and CPU usage to locate slow queries and then optimize them.

  1. View the slow SQL logs to check for slowly executed SQL queries and view their performance characteristics (if any) to locate the cause.
  2. View the CPU usage metric of your DB instance.
  3. Create read replicas to reduce read pressure on primary instances.
  4. Add indexes for associated fields in multi-table join queries.
  5. Do not use the SELECT * statement for full table scans. Instead, specify the fields you need or add the WHERE clause.