Important Database Metrics
A per-engine reference of the metrics worth collecting, and what each one tells you.
Every engine
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\GDistinctive 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".