• /
  • EnglishEspañol日本語한국어Português
  • 로그인지금 시작하기

View slow query details

In APM, when we collect transaction traces, we might also find some additional Slow query data and display it on the Databases page. Let's look at what slow query data is, where to find it, and how to configure it.

Sampling of slow query data

When transaction traces are reported, the slow queries feature samples the slowest database queries in those traces and reports data about them on the Databases page. Slow query data can include:

View slow query data

You can view data about slow SQL queries in our APM UI:

  1. Go to one.newrelic.com > All capabilities > APM & Services.
  2. Select an app.
  3. Under the Monitor section, click Databases.
  4. Select a database transaction.
  5. Click on any slow queries to get details. Screenshot showing the APM databases page with slow queries

If you do not see expected slow query data, follow the troubleshooting tips.

Configuration

In general, you can configure your slow query settings either of these ways:

Agent configuration gives you more options than server-side configuration does. How you choose to configure slow queries will depend on your own setup and preferences. For more information, see the documentation for the specific agent:

Slow queries metrics

The slow queries list contains the following metrics:

Metric

Description

Response time

The average response time (in milliseconds) for the statements sampled.

Sample count

The number of slow queries identified in the sample.

To view additional details, select an individual slow query:

Metric

Description

Start time

When the stack trace began collecting the data shown.

Max time

The maximum time for all similar query statements in the sample.

Action

The action or process invoking the query.

Query

The query that is being reported as slow. Depending on your configuration, some parts of the query may be obfuscated.

Stack trace

Where in the code the statement was called.

For MySQL, we provide a query analysis, which explains what happened in your query and what you might do to speed it up. Other databases display an explain plan whenever possible.

Troubleshooting: No slow query data

If you don't see slow query data, it's possible that we don't instrument your particular database for slow SQL.

It's also possible you have configuration issues:

  • The slow query feature has been disabled.
  • The duration of the threshold is set too high and no slow queries are being reported.
  • The query obfuscation setting (usually record_sql or similar) may be set to Off.

See configuration options for more information.

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.