AI SRE for Databases
Turn database alerts into a draft root cause analysis in minutes. The Sherlocks AI Watson agent reads your databases read-only, correlates query performance with recent deploys and schema changes, and posts the root cause in Slack with a confidence level and the evidence attached.
sre@prod-bastion ~ $ sherlocks investigate --source databasesALERT SIGNAL CORRELATEDhikaricp active 50/50 for 2m missing indexpg replica volume IOPS exceeded write burstrds writeiops > 1,000 IOPS daily batch jobelasticache conns > 1,500 HPA pod churn sre@prod-bastion ~ $ sherlocks explain vm-db-connection-pool-exhaustion
What Sherlocks AI does with your databases
Many production incidents are database incidents. A query that used to be fast is suddenly slow, a migration that looked clean in review changes a plan, a replica that was in sync yesterday falls behind. The hard part is rarely writing the fix. It is finding which of hundreds of possible causes is the real one.
Sherlocks AI uses your databases as a primary signal source. When an alert lands in Slack, 16+ AI agents correlate query performance, connection pools, replication state and recent changes, test hypotheses against the data, and deliver a draft root cause analysis in your incident channel.
Why database incidents take so long to explain
Database incidents are usually reported by something other than the database. A worker gets OOMKilled, an API times out, a connection pool empties, and the first alert names the application. Underneath, the cause sits in one of three layers that behave differently: storage, where a volume hits a throughput or IOPS ceiling; queries, where one plan regression changes the cost of a statement by two orders of magnitude; and connections, where the pool is a symptom rather than a cause.
So the on-call engineer opens pg_stat_statements, reads a query plan, checks replica lag and the storage metrics, and rules out the obvious first guesses one at a time. Raising the pool size on a plan regression just moves the failure into the database.
That checking is the part Sherlocks AI takes over. It generates hypotheses about the root cause, tests them against the data, and ranks them by likelihood and impact, so the engineer verifies the reasoning instead of redoing it.
Common database incidents, with real investigations
(05 Groups)The database failure classes teams hit most. Each group sits next to published database investigations, with the RCA guide and upstream documentation for each.
Query performance
- Slow query drift
- Missing index on a hot path
- Query plan regression
- Lock wait buildup
- N+1 queries from a new ORM path
The alert usually names the application, not the query. A support dashboard pod was OOMKilled because one request read 22.36 million rows into memory, so the alert pointed at Kubernetes while the cause was a single unbounded query.
Capacity and resource
- Connection pool exhaustion
- Memory pressure
- Disk filling up
- CPU saturation from one query
- IOPS throttling on managed instances
A pool that empties is usually a symptom. Concurrency in use is arrival rate times hold time, so a statement that slows a hundredfold multiplies held connections at unchanged traffic. A Celery worker here ran short of memory as its task backlog grew during an Aurora load surge.
Replication and availability
- Replica falling behind primary
- Failover that did not complete
- WAL buildup from an offline replica
- Replica diverged from primary
On a replica, replay and client queries compete for the same storage budget. A Postgres replica tripped VolumeIOPSExceeded because a write burst pushed its EBS volume past its provisioned throughput, while IOPS sat at 21% of the limit: a throughput throttle, not IOPS exhaustion.
Schema and migration
- Migration that added a slow query path
- ALTER on a large table blocking writes
- Foreign key cascades creating lock chains
- Index build that never completed
A migration can look clean in review and still change the cost of a statement by orders of magnitude. A user-service started returning 503s because a schema migration left a query without its index: 42-second queries emptied the connection pool across three app servers.
Operational
- Vacuum falling behind (PostgreSQL)
- Hot shard or hot partition
- Cache connection storm after a deploy (Redis)
- Backup job that failed silently
Cache alerts often trace back to the application tier. An ElastiCache cluster crossed 1,500 connections because HPA pod churn fanned out new connections, and another spiked from a WebSocket reconnect and reject loop.
How Sherlocks AI works with your databases
(04 Steps)- 1Step 1: Connect your databases, read-only.
Add them as integrations alongside the rest of your stack. Access is read-only and limited to metadata queries.
- 2Step 2: Install the Slack app.
Sherlocks AI monitors your Slack workspace for incident conversations, questions and alerts, so the database alerts your team already sends to Slack are where an investigation starts.
- 3Step 3: An alert fires.
An investigation is triggered manually, by the alert, or proactively. Watson reads query performance, connection pool and replication signals, then Sherlocks AI generates hypotheses, tests them against the data, and ranks causes by likelihood and impact.
- 4Step 4: The RCA lands in Slack.
The primary root cause with a confidence level, contributing factors, a timeline, recommended remediation, and links to the relevant logs, metrics, commits and dashboards. Engineers ask follow-up questions in the same thread.
Supported databases
(07 Engines)Query stats, connection pools and replication lag, on self-hosted Postgres, RDS, Aurora and Cloud SQL.
Query performance, replication status and deadlocks, on self-hosted MySQL, RDS, Aurora and Cloud SQL.
Operations, index stats and replication state.
Memory usage, client connections and keyspace stats, including ElastiCache.
Node health, compaction metrics and latency.
Log search, aggregations and cluster health.
Query performance, connection pools, replication lag and slow query patterns.
Running on a cloud provider? The AWS, Google Cloud and Azure pages cover RDS and Aurora, Cloud SQL and Azure SQL in more depth.
Security and data handling
All permissions are read-only. Sherlocks AI cannot modify your data, your schema or your configuration, and cannot create indexes or kill queries.
Database access is limited to INFORMATION_SCHEMA and metadata queries. Sherlocks AI reads query performance stats, replication status, connection pool metrics and slow query patterns, never table contents, PII or application records.
Watson runs inside your network. Only aggregated metrics and metadata are sent to the Sherlocks AI platform, or nothing at all with the self-hosted deployment.
Sherlocks AI cloud environment is annually audited against the SOC 2 Type 2 framework.
A real investigation, step by step
This is a published case from the examples section, not a mock-up. A connection pool alert fired at 100%, and the obvious first guesses were wrong. Here is how the investigation got from the pool alert to the missing index.
- 1The alertCriticalPrometheus JMX Exporter + Grafana2026-03-29 10:22 IST
HikariCP active connections at 100% (50/50) for > 2 minutes
50/50Active Conns42s (was 50ms)Query Time2,891HTTP 503s - 24 hypotheses ruled out
Connection leak: app borrows connections and never releases them
All 150 connections are in 'active' state executing queries, not idle or leaked. After the index fix, pools drained within 2 minutes, proving connections were released normally.
Connection pool simply sized too small (config problem)
At 50ms/query, 85 req/sec needs only ~4 concurrent connections, far inside 150. The pool is not the constraint. After the index dropped query time to 12ms the pool drained immediately.
Traffic spike alone overwhelmed the service
The spike only mattered because it exposed a latent regression. At 50ms, 85 req/sec is trivial for a 150-connection pool. Ruled out as a standalone cause; it is the trigger, not the cause.
Database statistics are stale causing poor query plans
Running ANALYZE did not change the query plan; the issue is structurally a missing index, not stale stats.
- 3Root cause
Flyway V32 added region without an index while the query was changed to filter by it
V32 added the region column and backfilled but the CREATE INDEX line was omitted. The query was simultaneously changed to filter by region first, bypassing idx_users_status and forcing a Seq Scan on 5M rows (42s). Pool exhausted, 2,891 HTTP 503s.
- 4The fix
- Create composite index on (region, status, last_login) immediately to resolve the sequential scan.
- Add a Flyway migration review checklist: any new WHERE clause column must have a corresponding index.
For the general method, read how to debug connection pool exhaustion, or browse every database investigation.
Why Sherlocks AI for database incidents
Workers get OOMKilled, an API times out, a pool empties, and the first alert names the application. Sherlocks AI follows the signal down to the storage, query or connection layer where the cause actually is.
PostgreSQL, MySQL, MongoDB and Redis are covered by the same investigation, so a multi-database stack does not need a separate tool per engine.
Query performance stats, replication status and pool metrics, never table contents.
Every root cause comes with a confidence level and the evidence behind it, including the hypotheses that were ruled out.
Frequently asked questions
(07 Questions)Can Sherlocks AI investigate database incidents?
Yes. The published investigations on this site include a connection pool exhausted by a missing index after a schema migration, a PostgreSQL replica throttled on EBS throughput, an Aurora load surge that grew a worker's backlog, and an RDS WriteIOPS alarm that turned out to be a daily batch job. Each is worked from the alert to a root cause, with the hypotheses that were ruled out.
Which databases does Sherlocks AI work with?
PostgreSQL, MySQL, MongoDB, Redis, Cassandra and Elasticsearch, including managed PostgreSQL and MySQL on Amazon RDS, Aurora and Cloud SQL, Azure SQL, and Redis on ElastiCache.
Does Sherlocks AI need write access to my database?
No. All permissions are read-only. Sherlocks AI cannot modify data, schema or configuration.
Can Sherlocks AI read my database without accessing application data?
Yes. Access is limited to INFORMATION_SCHEMA and metadata queries. Sherlocks AI reads query performance stats, replication status, connection pool metrics and slow query patterns, never table contents, PII or application records.
Why does a connection pool run out?
Usually because queries got slower, not because traffic grew. Connections in use equal arrival rate multiplied by mean hold time, so a statement that goes from 4 ms to 900 ms multiplies held connections by more than two hundred at the same traffic. Check query duration and pg_stat_activity wait events before raising the pool size.
How does a database alert become an investigation?
Sherlocks AI monitors your Slack workspace for incident conversations and alerts. An investigation can be triggered manually, by an alert, or proactively. Watson reads the relevant database and infrastructure signals, and Sherlocks AI generates hypotheses, tests them against the data, and ranks them by likelihood and impact.
How do I know whether to trust a root cause?
Every root cause comes with a confidence level, and every claim cites the logs, metrics or commits it rests on. The published investigations also show the hypotheses that were checked and ruled out.
Get started
Start free with 30 investigations per month, or book a 30-minute demo and we will walk you through a live incident replay on your own database setup.
Questions? Get in touch.
Sherlocks AI is used by Fynd, Topmate, Wafeq, TradeIndia, and Lokal to investigate production incidents. SOC 2 Type 2 certified. Watson runs read-only.