When your database slows down, knowing the metrics is only half the battle. Grafana Cloud Database Observability already provides deep visibility into SQL queries through RED metrics, execution samples, wait event breakdowns, table schemas, and visual explain plans. But seeing a P99 latency spike or a cryptic wait event like wait/synch/mutex/innodb is just the start—the real challenge is understanding what to do next.
That's where the new Grafana Assistant integration for Database Observability steps in. It combines the power of AI with your actual observability data, helping you diagnose and resolve performance issues faster and with less guesswork.
How Grafana Assistant Supercharges Observability
The assistant isn't a generic AI tool that works from a copy-pasted SQL snippet. Instead, it runs against your real Prometheus and Loki data sources, within the exact time window you're investigating, and with your actual table schemas, indexes, and execution plans already loaded. This means every analysis is grounded in your production environment.
Purpose-Built Analysis Actions
Rather than relying on generic prompts, the assistant offers pre-defined analysis buttons crafted by database engineers. Each action is tailored for common scenarios like slow queries, degraded performance, or schema recommendations. You can still prompt freely via the chat box, but these guided buttons provide a faster path to answers.
Real-World Example: Diagnosing a Slow Query
Imagine you've identified a query with spiking duration and climbing error rates. You click into it and see time-series performance data, but the root cause isn't obvious. Is it a bad join? Lock contention? A table scan that grew problematic with data volume?
With one click on the assistant's pre-defined prompt, the AI gets to work. It queries Loki and Prometheus, synthesizing the data into a health assessment. It might reveal:
- Rows examined are 50 times the rows returned—indicating most work is wasted on filtering.
- P99 latency is 12x the median, pointing to intermittent rather than constant issues.
- CPU time is healthy, but wait events consume 40% of execution time.
The crucial insight is that the assistant interprets obscure wait event names like wait/synch/mutex/innodb or io/table/sql/handler. It translates them into actionable advice: "During this wait, the database is contending for an InnoDB internal lock. Consider reducing concurrency or optimizing indexes." This saves you from having to manually decode the database's internal diagnostics.
Understanding Wait Events Without Headaches
Wait events are a rich source of performance clues, but their cryptic names can be intimidating. The Grafana Assistant removes that barrier by:
- Automatically mapping wait event names to plain-English explanations.
- Correlating wait events with other metrics (e.g., execution time, rows examined) to pinpoint root causes.
- Providing specific recommendations based on the observed pattern.
Data Privacy and Security
Your query text and schema metadata are used only for the current analysis. They are not stored or used for model training. This ensures that sensitive database information remains under your control while still benefiting from AI-driven insights.
Conclusion
The Grafana Assistant integration transforms Database Observability from a passive monitoring tool into an active troubleshooting partner. By combining context-aware AI with pre-built analysis actions, it reduces mean time to resolution (MTTR) for performance issues. Whether you're dealing with a slow query, puzzling wait events, or intermittent spikes, the assistant helps you move from "what happened?" to "what to do about it?" in record time.
For more details, explore the purpose-built analysis actions or learn how to diagnose slow queries step by step.