Troubleshooting guide

MariaDB High CPU Usage: Causes, Checks and Fixes

Troubleshoot MariaDB high CPU caused by slow queries, missing indexes, table scans, connection spikes, cron jobs and application workload.

Remote support availableCommercial systemsService: MariaDB Performance Tuning
MariaDBhigh CPUslow queriesindexesperformance

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 backups 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 help identify the direction of the issue. Always adjust paths, service 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 help

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

Need this fixed?

Get remote support for this issue.

Fixed technical support starts from $499. Emergency incident support is $199/hr with a minimum window.

Contact Us

Related guides