CloudLinux.ro
Monitoring & logging

How to monitor database performance

Updated 7/20/2026

The database is often the slowest part of an application. Monitoring shows you where the problems are before they get serious.

MySQL: what to watch

SHOW PROCESSLIST;                 # active queries
SHOW GLOBAL STATUS LIKE 'Threads_connected';

Enable the slow query log to find them, see MySQL optimization.

PostgreSQL: what to watch

SELECT * FROM pg_stat_activity;   # connections and queries
SELECT * FROM pg_stat_database;

Important metrics

  • Slow queries: those over 1 second, usually from a missing index.
  • Connections: too many open connections can exhaust resources.
  • Cache hit ratio: how often data is found in memory, not on disk.

Visual tools

Grafana has ready-made dashboards for MySQL and PostgreSQL, see Prometheus and Grafana.

When the database needs more

If queries are optimized but the database is still slow, it needs more RAM. With hourly billing you move to a bigger plan in minutes.

Put this guide into practice on your own VPS

EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.

See pricing

Related tutorials