All posts
Monitoring3 min readWatchFor Team

Database Monitoring: what to watch (and why)

When the database struggles, everything that depends on it struggles too — usually as timeouts and slow pages. Here's what to monitor so the DB never becomes your silent bottleneck.

Database Monitoring: what to watch (and why)

Behind a surprising number of "the site is slow" and 504 timeout incidents sits the same quiet culprit: the database. Apps wait on it, and when it slows, the slowness ripples outward into every page and API call. Yet the database is often the least-monitored part of the stack. Let's fix that.

Why the database deserves special attention

Your app might be fast and your servers healthy, but if a query is crawling, users feel it everywhere. The database is a shared dependency — one slow query or an exhausted connection pool can degrade the entire application at once. Monitoring it turns "the app is randomly slow sometimes" into a specific, fixable cause.

What to watch

SignalWhy it matters
Query latencySlow queries are the #1 cause of slow apps
Slow query logPinpoints which queries to fix
ConnectionsA full connection pool blocks new requests
ErrorsFailed queries, deadlocks, constraint violations
Replication lagReplicas falling behind serve stale data
Cache hit ratioLow ratios mean the DB is working too hard
Disk & memoryA full disk or thrashing memory takes the DB down hard

Query latency and slow queries

This is the big one. Track how long queries take — and especially the p95/p99, because the slowest queries cause the most pain. The slow query log is gold: it names the exact queries crossing your threshold, which is usually where a missing index hides.

Connections

Databases allow a limited number of simultaneous connections. When that pool is exhausted, new requests can't get a connection and just wait — which surfaces as timeouts in your app even though the DB itself is "up." Watch connection count against the limit.

Replication lag

If you use read replicas, lag means replicas are behind the primary — so reads return stale data, and a failover could lose recent writes. Spiking lag is an early warning of trouble.

Watch the trend

A slow query rarely arrives suddenly — it grows. A query that was fine at 10,000 rows crawls at 10 million. Watching latency over time catches the gradual slide before it becomes an outage, and points you at the query to optimise (usually with an index).

Connecting it to user impact

Database problems show up to users as application symptoms — timeouts, slow pages, 504s. That's why DB monitoring pairs so well with uptime and response-time monitoring: the external checks tell you something is slow, and the database metrics tell you it's the DB, and here's the query.

The bottom line

WatchThe risk it catches
Query latency / slow logThe #1 cause of slow apps.
ConnectionsPool exhaustion → app-wide timeouts.
Errors & deadlocksFailed operations and contention.
Replication lagStale reads and risky failovers.
Disk / memoryHard, sudden database outages.

The database is the shared dependency everything leans on. Watch query latency and the slow log first, keep an eye on connections and replication, and focus on trends — and the DB stops being the mystery behind your "randomly slow" days.

Related: 504 Gateway Timeout, latency percentiles, and server monitoring basics.

Share this article