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

Relic Solution: Understanding the Limit Clause in NRQL Queries

nrql
limit
query

#1

NRQL is certainly one of the most powerful aspects of Insights, allowing you to zero in on the exact data you need for monitoring or reporting your app’s performance. :chart_with_upwards_trend: There is a clause you can use in NRQL queries that let’s you get even more exact results: LIMIT.

By default, all NRQL queries return 10 results (or 100 for * queries). Perhaps you need to see fewer results, or a whole lot more. Employing the LIMIT clause in your NRQL query will allow you to specify the exact number of results you want to see. from 1 to 1,000. There is a hard 1,000 results limit on all NRQL queries. Just add the LIMIT clause to your next NRQL query to test it out.

For example, this query shows the top 20 countries by session count and provides 95th percentile of response time for each country for Windows users only:

SELECT uniqueCount(session), percentile(duration, 95)
  FROM PageView WHERE userAgentOS = 'Windows'
  FACET countryCode LIMIT 20 SINCE YESTERDAY

Ready to learn more about NRQL queries? Here are some great New Relic resources:

NRQL Reference - NRQL syntax, components and functions


Max CPU Stats Decline Over Longer Period