Skip to content
Navigation

Type at least two characters. Search covers page titles, headings, tags and database names.

↑ ↓ to navigateEnter to openEsc to close0 pages
Monitoringintermediate

Important Database Metrics

A per-engine reference of the metrics worth collecting, and what each one tells you.

2 min readIntermediateUpdated Edit this page

Every engine

MetricWhy
Query latency percentilesThe user-visible measure
Connections used / maximumThe most common hard limit
Disk used and growth rateFails abruptly, and recovery may need space
Memory used / limitPredicts eviction, spilling or an OOM kill
Error rate by classRising errors precede visible outages
Replication lag per replicaSilent until a failover
Time since last successful backupSilent until a restore
Time since last verified restoreThe only proof backups work

PostgreSQL

-- The queries behind the metrics.
SELECT state, count(*) FROM pg_stat_activity GROUP BY state;
SELECT * FROM pg_stat_replication;
SELECT datname, xact_commit, xact_rollback, deadlocks, temp_bytes FROM pg_stat_database;
SELECT relname, n_dead_tup, last_autovacuum FROM pg_stat_user_tables ORDER BY n_dead_tup DESC;
SELECT max(age(relfrozenxid)) FROM pg_class WHERE relkind = 'r';
SELECT last_archived_time, failed_count FROM pg_stat_archiver;

Distinctive ones: dead tuples and vacuum age (bloat and wraparound), temp_bytes (queries spilling because work_mem is too small), and archiver failures (silently broken point-in-time recovery).

MySQL / MariaDB

SHOW GLOBAL STATUS LIKE 'Threads_running';
SHOW GLOBAL STATUS LIKE 'Innodb_buffer_pool_read%';
SELECT count FROM information_schema.innodb_metrics WHERE name = 'trx_rseg_history_len';
SHOW REPLICA STATUS\G

Distinctive ones: Threads_running (the sharpest saturation signal), undo history length (purge blocked by a long transaction), and both replica thread states.

Redis / Valkey

used_memory against maxmemory, evicted_keys, keyspace_hits and keyspace_misses, blocked_clients, mem_fragmentation_ratio, master_link_status, and the persistence status fields rdb_last_bgsave_status and aof_last_write_status.

ClickHouse

Parts per partition (approaching the insert-throw threshold), system.replicas.absolute_delay and is_readonly, unfinished mutations, MemoryTracking, and free disk — merges need headroom.

MongoDB

Replication lag per member, oplog window, WiredTiger cache usage and eviction, globalLock.currentQueue, connection count, and any member not in PRIMARY or SECONDARY.

Cassandra / ScyllaDB

Pending compactions, SSTables per read, tombstones per read, dropped messages, coordinator latency per request type, and — for ScyllaDB — per-shard reactor utilisation rather than node averages.

Elasticsearch / OpenSearch

Cluster status, unassigned shards, JVM heap percentage and GC time, thread pool rejections, disk watermarks, and snapshot policy failures.

Retention

Keep fifteen-second resolution for a few days for incident investigation, and one-minute or coarser for a year for capacity forecasting. Both horizons are needed: the first answers "what happened", the second answers "when do we run out".