Understand wait events
Wait events show where your queries spend time waiting for resources instead of actively executing. Understanding wait events helps you identify resource contention, lock conflicts, and I/O bottlenecks that cause performance problems.
What are wait events
When a query executes, it alternates between:
- Active execution: CPU is processing the query
- Waiting: Query is blocked, waiting for a resource
Wait events capture what the query is waiting for. High wait times indicate that queries are spending significant time blocked rather than executing.
Why wait events matter
Wait events reveal performance problems that other metrics miss:
Access wait events
To view wait events in Database Observability:
- Navigate to Database Observability in Grafana Cloud.
- In the Queries Overview, note the Wait Events Duration chart showing cumulative wait time.
- Click a query to open its details.
- Select the Wait Events tab for detailed analysis.
Overview dashboard wait events
The Queries Overview shows a bar chart of cumulative wait event duration by category. This gives you a quick view of where queries spend the most time waiting.
The overview chart groups individual wait event types into high-level categories for easier visualization:
PostgreSQL categories:
MySQL categories:
Wait Events tab
The Wait Events tab shows a time series chart of wait events for a specific query. Use the dropdown to switch between four views:
- Cumulative duration of wait events (by group): Stacked bars showing total wait time for each category (IO Wait, Lock Wait, Network Wait) over time. This is the default view.
- Cumulative duration of wait events (breakdown): Stacked bars broken down by individual wait event name (for example,
Lock:relation,IO:DataFileRead), giving a more granular picture. - Number of wait events: Count of wait events by category over time.
- Wait events duration (by group): Average duration per event by category over time.
Use wait events for diagnosis
This workflow shows how to use wait events to narrow down the source of latency.
Workflow: Diagnose slow queries
- Identify affected queries: In the Queries Overview, find queries with high wait event duration.
- View wait events tab: Click the query and open the Wait Events tab.
- Compare views: Use the dropdown to switch between cumulative duration, event count, and average duration to understand the wait pattern.
- Drill into duration of wait events (breakdown): Switch to the breakdown view to see which specific wait events contribute the most time.
- Take action: Apply fixes based on the dominant wait event type (refer to the tips below).
The following table lists common scenarios you may encounter:
Tips for addressing wait events
Use these tips to address the most common wait event patterns.
Lock contention
- Review transaction isolation levels
- Consider optimistic locking patterns
- Break long transactions into smaller units
- Check for deadlock patterns
I/O contention
- Add indexes to reduce table scans
- Increase memory/buffer pools
- Review disk performance
- Consider read replicas for read-heavy workloads
Buffer contention
- Tune shared buffer settings
- Review concurrent access patterns
- Consider connection pooling adjustments
Related documentation
- Examine query samples: See when waits occurred
- Analyze explain plans: Understand query execution
- Improve slow queries: Optimization workflow
- MySQL configuration:
Performance Schemasetup - PostgreSQL configuration:
pg_stat_activityaccess - Troubleshoot Database Observability: Resolve setup and configuration issues



