In APM, transaction traces can contain database query data. Use the Database queries page to analyze a slow transaction or change database query collection settings.
If database query data is associated with your selected transaction trace, the Database queries page will be visible from the Transaction trace details page.
If you expect to see database data for a transaction trace but don't see it, you may need to change the Database query settings.
Go to one.newrelic.com > All capabilities > APM & services > (select an app) > Monitor > Transactions > (select a transaction trace) > Database queries.
Use the Database queries page to analyze and troubleshoot a slow transaction. For example:
- You notice on the APM Overview page that a transaction is abnormally slow.
- You select a transaction trace to get more details about that transaction.
- If the trace has associated database data, you select the Database queries page to examine the slow queries in the trace, and use them as the basis to troubleshoot and improve your app's performance.
Other functions include:
If you want to...
Hide fast calls
By default, New Relic shows all queries, including fast calls (
View stack traces
To view stack traces associated with a database query, click the database icon (in the table's Total duration column).
You can change database query settings in the same way you change other transaction trace settings; for example, via configuring the New Relic agent or, for some agents, via the UI.
Common database query setting changes include:
- Collecting raw query data instead of obfuscated or turning off query collection
- Changing the stack trace threshold
- Turning on query explain plan collection
Here are some tips to improve your app's database performance:
Use database queries
Look for queries where the
Look for queries that repeatedly query the same kind of information; for example, multiple queries to look up individual account IDs. Try rewriting the query to
Look at the structure of your queries to see if there are opportunities to combine different types of information into a single call; for example, querying for the account ID, name, etc. This is useful, for example, if your database center is in a different geographical location, because this will reduce overhead.
The amount of time for your database request and response may be very fast. However, by combining requests into fewer calls, you can reduce that time even more.
From your app's main APM Summary page, compare the database time on the main chart to other processing time. Sudden spikes or larger amounts of database time compared to other processing times may indicate problems.
The Trace details page is useful for examining a specific transaction's details. To see all of your application's slowest queries in one place, use the Slow queries feature.