Performance Troubleshooting Runbook
HeliosDB Performance Troubleshooting Runbook
Use this runbook when query latency, CPU, memory, disk I/O, or network latency is outside normal operating ranges.
Slow Query Identification
Find active slow queries:
SELECT pid, now() - query_start AS duration, state, wait_event_type, queryFROM pg_stat_activityWHERE state <> 'idle'ORDER BY duration DESCLIMIT 20;Review historical query cost:
SELECT query, calls, mean_exec_time, max_exec_timeFROM pg_stat_statementsORDER BY mean_exec_time DESCLIMIT 20;High CPU Investigation
- Check whether CPU is query execution, compaction, background jobs, or connection churn.
- Identify top active queries.
- Compare current traffic to baseline.
- Throttle noncritical workloads if customer traffic is affected.
- Scale capacity only after confirming the workload is legitimate.
Memory Pressure Analysis
Indicators:
- Increasing swap or OOM events.
- Cache hit ratio degradation.
- Large sorts or hash joins spilling.
- Growing connection count.
Actions:
- Reduce unnecessary connections.
- Inspect query plans for memory-heavy operations.
- Tune workload memory limits conservatively.
- Scale memory if pressure is sustained.
Disk I/O Bottlenecks
Check:
- Disk latency and throughput.
- WAL write latency.
- Checkpoint frequency.
- Temporary file usage.
- Backup or maintenance overlap.
Mitigation options:
- Pause noncritical maintenance.
- Move backups or temp work off saturated storage.
- Increase IOPS or storage class.
- Add replicas for read pressure.
Network Latency Debugging
- Compare client-to-load-balancer latency with node-to-node latency.
- Check regional routing and DNS changes.
- Validate TLS or proxy overhead.
- Check packet loss and retransmits.
- Use regional failover only after confirming the primary path is impaired.
Performance Tuning Checklist
- Query plan uses expected indexes.
- Table statistics are current.
- Connection pool limits are sane.
- Replication lag is stable.
- Cache hit ratio is within baseline.
- Disk queue and WAL latency are normal.
- Recent deployments or configuration changes are reviewed.