In APM, when transaction traces are collected, there may be additional Slow query data available on the Databases page. Let's look at what slow query data is, where to find it, and how to configure it.
- Duration of query segments
- Query/explain plans (if recognized)
- Host and instance level details (if supported by agent)
To get a high-level overview of all your applications and services, use the New Relic Explorer.
To see your slow query data:
- Do one of the following:
- Select a database transaction.
- If available, select any available slow queries listed on the page.
If you do not see expected slow query data, follow the troubleshooting tips.
In general, you can configure your slow query settings either of these ways:
- Agent configuration
- Server-side configuration (if available for your agent)
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:
The slow queries list contains the following metrics:
The average response time for the statements sampled.
The number of slow queries identified in the sample.
To view additional details, select an individual slow query:
When the stack trace began collecting the data shown.
The maximum time for all similar query statements in the sample.
The action or process invoking the query.
The query that is being reported as slow. Depending on your configuration, some parts of the query may be obfuscated.
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.
If you do not see slow query data, it may be for any of these reasons:
- The slow query feature has been disabled.
- The threshold is set to too high a duration and no slow queries are being reported.
- The query obfuscation setting (usually
record_sqlor similar) may be set to
To solve the problem, try adjusting the configuration options.
If you need more help, check out these support and learning resources:
- Browse the Explorers Hub to get help from the community and join in discussions.
- Find answers on our sites and learn how to use our support portal.
- Run New Relic Diagnostics, our troubleshooting tool for Linux, Windows, and macOS.
- Review New Relic's data security and licenses documentation.