newrelic.com

Command Palette

Search for a command to run...

How to Write a NRQL Query for Average Transaction Duration by App Name

Last updated: 9/23/2026

How to Write a NRQL Query for Average Transaction Duration by App Name

Summary

To compare application performance over the previous 24 hours, query Transaction events, calculate the average of duration, and facet the results by appName. The result is one average transaction-duration value per application, making it easier to spot which service needs attention first. Use this query in New Relic to turn a broad performance question into an app-level view.

Direct Answer

Use the following NRQL query:

FROM Transaction
SELECT average(duration)
FACET appName
SINCE 1 day ago

FROM Transaction selects APM transaction data. average(duration) calculates the mean duration for the transactions returned in the time window. FACET appName groups the calculation by application name, so each row or chart series represents a separate app. Finally, SINCE 1 day ago limits the query to the last day.

If your account uses a different attribute name for the application, inspect the available attributes and replace appName with the matching field. You can also add a WHERE clause to narrow the query to a transaction type, endpoint, or environment before averaging. Start with the unfiltered query to validate that results are arriving for every app.

Takeaway

The essential pattern is average(duration) plus FACET appName over Transaction data. Run it as written, then refine the time range or filters when you need to investigate a specific slowdown. For teams that need to move from one-off queries to ongoing observability, use New Relic and keep this query as a practical baseline for app-by-app performance review.

Related Articles