Grafana Cloud

View query performance

The Queries Overview dashboard provides a comprehensive view of your database performance, allowing you to monitor query execution, identify slow queries, and understand resource consumption patterns. This dashboard serves as your starting point for investigating database performance issues.

Key dashboard components

The Queries Overview dashboard contains several key sections that provide different perspectives on your database performance:

Summary metrics

At the top of the dashboard, you’ll find high-level metrics that give you an immediate overview of database activity:

  • Duration Average: Shows the average query execution time
  • Errors: Displays the total number of query errors and error percentage
  • Rate: Indicates queries per second and total query count

Understand key metrics

The metrics displayed in the Queries Overview dashboard provide insights into different aspects of database performance. Understanding what each metric represents and how to interpret the values helps you quickly identify performance issues and prioritize optimization efforts.

Duration metrics

Duration metrics help you identify slow queries and performance trends:

  • Average duration: Indicates typical query performance
  • Duration spikes: Sharp increases may indicate performance issues
  • Cumulative wait events: Shows where queries spend time waiting

Error indicators

Error metrics highlight potential issues:

  • Error percentage: High percentages indicate problematic queries
  • Error distribution: Shows which queries are failing most frequently
  • Error trends: Patterns may indicate systemic issues

Query execution patterns

Rate and frequency metrics reveal usage patterns:

  • Queries per second: Shows database load and activity levels
  • Call frequency: Identifies most frequently executed queries
  • Execution distribution: Reveals peak usage times and patterns

Query performance table

The main table displays individual queries with the following information:

  • Query: Normalized SQL statement with syntax highlighting for improved readability
  • Database: Database or schema where the query executes
  • Instance: Database instance identifier
  • Wait Events Duration: Visual representation of wait events over time
  • Calls: Number of times the query was executed
  • Duration: Total and average execution time
  • Errors: Error count and percentage for each query
  • Rate: Average rate a query is called
  • Lock Time: Average time a query spends waiting on table locks
  • Rows Examined: Average number of rows examined by this query on each execution
  • Rows Sent: Average number of rows sent by this query on each execution
  • Rows: Average number of rows affected and returned by this query on each execution

Follow this workflow to effectively use the dashboard for performance monitoring:

  1. Start with summary metrics

    Begin by reviewing the high-level metrics at the top of the dashboard:

    • Check the overall error rate for any immediate concerns
    • Review average duration to understand general performance
    • Examine the queries per second rate to assess current load
  2. Identify problematic queries

    Use the query performance table to find issues:

    • Sort by duration to find the slowest queries
    • Look for queries with high error percentages
    • Identify frequently called queries that might benefit from optimization
  3. Analyze time-based patterns

    Use the time-series charts to understand trends:

    • Look for duration spikes that correlate with application events
    • Identify recurring patterns that might indicate scheduled jobs
    • Check if error rates correspond to specific time periods
  4. Drill down for detailed analysis

    When you identify a query of interest:

    • Click on the query to access detailed performance tabs
    • Use the Query Performance tab for execution metrics
    • Review Query Samples for actual query instances
    • Examine Wait Events to understand resource contention
    • Check Table Schema Details for optimization opportunities
    • Use the Explain Plan tab to analyze query execution strategy
    • Try the AI Helper tab for optimization suggestions
  5. View infrastructure metrics

    For cloud-managed databases (AWS RDS, Aurora, Azure Database), you can view infrastructure metrics alongside query performance:

    1. Click on a query in the table to open details.
    2. Click the Instance name in the query details.
    3. A side panel displays cloud provider metrics:
      • CPU utilization
      • Memory usage
      • IOPS (read/write)
      • Network throughput

    Use this to correlate query performance issues with infrastructure constraints. For example, identify when slow queries coincide with high CPU utilization or IOPS limits.

    Note

    Infrastructure metrics require configuring the cloud_provider block in Alloy. Refer to Add cloud provider integrations for setup instructions.

  6. Set time ranges for investigation

    Use the time picker to focus your analysis:

    • Select specific time ranges when issues occurred
    • Compare performance across different time periods
    • Zoom in on specific incidents for detailed investigation