Your data. Anywhere you go.

New Relic for iOS or Android

Download on the App Store    Android App on Google play

New Relic Insights App for iOS

Download on the App Store

Learn more

Close icon

Database query statements by transaction?



In the UI I can click about and see which database transactions a web transaction calls. I can also see on a database transaction which transactions call it and how much time percentage each transaction makes up of the overall database transaction time.

Is there a way to fetch this info from the API’s?

I’m attempting to breakdown database performance by transaction.

A use case might be that I have a dozen web transactions that call the same database statement. However, one transaction results in that database transaction taking 10 seconds. The others result in 10ms. Ideally, I would like to group the performance metrics for the database statement by transaction so we can see the bad actors easily.



I’m afraid that neither the APM REST API nor Insights has the ability to retrieve that data for you.

However, that is a great feature request and I’ve tag this posting so we can create one for you.

Sorry we don’t have a good solution for you, yet.


Hi, @6MM: Though we do not send query details to Insights by default, we do capture the number of database queries per transaction and their total duration, so you can execute a query like this:

SELECT average(databaseDuration) * 1000 AS 'Avg Database Duration (ms)',
       average(databaseCallCount) FROM Transaction 
WHERE appName = 'My Application' FACET name

You can use this information to decide which transactions to investigate in APM to figure out which queries they are calling.


Sure, we already use the insights level data similar to what you show. It doesn’t solve the need I’m describing. The data lives somewhere, but its not accessible.

Counting the database calls by transaction doesn’t tell me distinct calls by query or similar.


Understood. I’m not trying to downplay the need for your feature request, just explaining (for others who may encounter this thread) what is currently possible. Thanks!


Hi …

Has this feature now been built into the system? or are there any plans to have it made available soon?



Hi @randeep.sawhney - this is not currently available. I will pass along your need for this, please include your specific use case as well! This will help our Product Managers prioritize.



Any update on this ?


No update right now @Shriram.Krishnan - I’ll get your +1 added though!