Overview
This guide helps you identify and resolve performance issues in CockroachDB. Learn how to diagnose slow queries, high latency, resource bottlenecks, and other common problems.Diagnostic Approach
Common Performance Issues
Slow Queries
Symptoms
- Queries taking longer than expected
- Timeouts in application
- High P99 latencies
Diagnosis
Solutions
High Transaction Conflicts
Symptoms
RETRY_WRITE_TOO_OLDerrorsRETRY_SERIALIZABLEerrors- High transaction retry rate
Diagnosis
Solutions
Hotspots and Range Splits
Symptoms
- Uneven load distribution across nodes
- High CPU on specific nodes
- Sequential key inserts causing bottlenecks
Diagnosis
Solutions
High Memory Usage
Symptoms
- Out of memory (OOM) errors
- Slow garbage collection
- Node crashes
Diagnosis
Solutions
Reduce memory usage by:
- Adding LIMIT clauses to large result sets
- Breaking large transactions into batches
- Using streaming instead of loading all results
- Reducing sort and hash join sizes
Replication Lag
Symptoms
- Followers falling behind leaseholder
- Increased read latency
UNAVAILABLErange errors
Diagnosis
Solutions
- Increase node resources (CPU, disk I/O)
- Reduce write load or batch writes
- Check network latency between nodes
- Ensure sufficient replica count
Disk I/O Bottlenecks
Symptoms
- High disk latency
- Slow write performance
storage: file is closederrors
Diagnosis
Monitor disk metrics:- IOPS (Input/Output Operations Per Second)
- Read/write latency
- Queue depth
Solutions
Network Latency
Symptoms
- High cross-region query latency
- Slow distributed queries
- RPC timeouts
Diagnosis
Solutions
Diagnostic Queries
Cluster Health
Query Statistics
Resource Usage
Monitoring Tools
Admin UI
Access the Admin UI athttp://<node-address>:8080:
- Overview: Cluster health and capacity
- Metrics: CPU, memory, disk, network
- SQL Activity: Query statistics and slow queries
- Network Latency: Round-trip times between nodes
- Replication: Range distribution and health
Command-Line Tools
Escalation Checklist
When to contact support: Provide the following when contacting support:- Debug zip:
cockroach debug zip - Cluster version and configuration
- Reproduction steps
- Recent changes to cluster or workload
- EXPLAIN output for problematic queries
- Timeline of when issue started