Problem Statement
High database latency directly impacts page loading times and user satisfaction. Use this playbook to identify database constraints and optimize query plans.
When to Use
Use when application response times increase under load, or when database CPU and memory metrics exceed baseline thresholds.
Step-by-Step Guide
Step 1: Query Plan Analysis
- Run
EXPLAINstatements on slow query targets. - Identify queries executing table scans instead of index lookups.
Step 2: Index Design
- Index foreign keys and fields commonly used in
WHERE,ORDER BY, orJOINconditions. - Prevent duplicate or overlapping composite indexes.
Step 3: Connection Pool Optimization
- Review maximum database connection limits.
- Optimize application-side connection recycling settings.
Checklist Items
- Slow query log is active and generating analysis outputs.
- No queries execute full table scans on large tables in production.
- Database connections are managed via connection pooling logic.
- Read-only requests are separated or routed to database replicas.
- Index usage stats are monitored and unused indexes are removed.