Troubleshooting guide

Troubleshooting Guide: MariaDB High CPU Usage

Use this guide to work through the most likely causes, gather useful evidence and make production-safe changes without turning a small problem into a larger outage.

Remote consulting availableCommercial platformsService: MariaDB Performance Tuning
MariaDBhigh CPUslow queriesindexesperformance tuning

What this problem usually means

MariaDB high CPU usually means the database is doing expensive work: table scans, joins without indexes, too many concurrent queries, maintenance jobs, or application code repeatedly asking inefficient questions.

Production caution: Killing queries can reduce load temporarily, but the real fix is usually indexing, query changes, workload control or scheduling.

Common symptoms

  • mysqld uses high CPU for long periods
  • WordPress or application pages load slowly
  • CPU spikes at predictable times
  • Database process list shows many running queries
  • Admin dashboards or checkout pages time out

Common causes

  • Missing or unused indexes
  • Large table scans from plugins or reports
  • Too many concurrent connections
  • Cron tasks or backup processes running during traffic
  • Poorly optimised queries after an application update
  • Storage latency causing queries to pile up

Safe first checks

These checks are intended to assist identify the direction of the issue. Always adjust paths, solution names and commands for your environment.

Show running queries

mysqladmin processlist

Enable/check slow query log

mysql -e "SHOW VARIABLES LIKE 'slow_query_log'; SHOW VARIABLES LIKE 'long_query_time';"

Check CPU and I/O

top -o %CPU -b -n1 | head -20; iostat -xz 1 3

Review table sizes

mysql -e "SELECT table_schema, ROUND(SUM(data_length+index_length)/1024/1024) MB FROM information_schema.tables GROUP BY table_schema ORDER BY MB DESC;"

Typical fixes

  • Use slow query logs to find repeat offenders
  • Add or adjust indexes carefully
  • Reduce heavy plugin/reporting workload
  • Move maintenance jobs away from peak traffic
  • Tune connection and buffer settings to fit server resources
  • Investigate disk latency when CPU and I/O rise together

When to get assist

Get assist if the system is production-facing, customer data is involved, backup processes are uncertain, or the issue affects revenue, security hardening or uptime. We can review the logs, confirm the cause and quote a fixed-scope fix where appropriate.

Need this fixed?

Get remote engineering help for this issue.

Fixed engineering help starts from $499. Emergency incident engineering assistance is $199/hr with a minimum window.

Contact us

Related guides