New Relic Insights’ query language, known as NRQL, allows New Relic users to run advanced queries against the database of information collected by Insights. These advanced queries let you ask questions about your application or business, providing a valuable view into customer trends or optimization problems on your website.

See also: Introduction to Writing NRQL Queries in Insights [Video]

If you are ready to really dive into New Relic Insights and want to write more complex, advanced NRQL queries, you might want to take a moment to check out this series of short 2-3 minute tutorials from New Relic University. This list will let you jump directly to a specific tutorial on the advanced query you want to learn more about:

Let’s take a closer look at each one:

Funnel Queries let you ask questions about the completion of steps in a process, or completion of a series of desired actions. This query format is particularly useful when trying to discover when people exit your site before making a purchase, for example.

NRQL query chart 1

Filtering is useful when you have a large chunk of data and you want to narrow the scope by a specific parameter. For example, you might have thousands of user zip codes but you want to view only users in a single zip code. Filtering lets you view only the zip code you want to see. NRQL query chart 2


Cohort Analysis makes it easy to group query results based on different time-based criteria. For example, if you want to know when peak traffic occurs on your application so you can optimize your site to handle those high-traffic times, you might want to break out your data by day like this:

NRQL query chart 3

Or you may want even more granular data, breaking out query results by hour, like this:

NRQL query chart 4

Advanced Segmentation allows you to break down your data for deeper analysis and then group your results together based on numerical values. This is especially helpful for getting information about things like user engagement. For example, if you want to see the number of users who looked at a page on your site, and then also want to see how long they spent looking at that page, you can write a query that displays the duration of a page view and break out durations by specified amounts. NRQL query chart 5


A Histogram Query creates a chart that is a graphical representation of the distribution of data. Each bar represents a bucket or grouping of data for the value of that attribute. The height of the bar shows the frequency with which events occurred in that particular grouping.

NRQL query chart 6


A Heat Map Query is fun variation on a histogram query that allows you to FACET a histogram query to show the intersection of two attributes using lighter and darker colors to indicate frequency.

NRQL query chart 7

The Percentile Function is another way to generate a specific chart. This chart is most helpful when accompanied by the TIMESERIES clause, which creates a nice line graph to view percentile data over time. NRQL query chart 8

Of course, your toolbox of advanced queries wouldn’t be complete without the Apdex Function. This function is an easy way to quickly create Apdex charts without affecting charts in any other parts of your New Relic account. You can also use this function to test different t values before making changes in New Relic APM or New Relic Browser. (The apdex t value is a numerical threshold you set based on what your goals are. For more information about setting a meaningful and relevant Apdex t value, check out the New Relic University tutorial Customizing Performance Thresholds.)

You can use this query function to view and compare overall Apdex scores:

NRQL query chart 9

You can also view and compare Apdex scores over time using the TIMESERIES function:

NRQL query chart 10

Finally, you can use basic mathematical functions in your NRQL queries to explore data in your app. You can apply addition, subtraction, multiplication, and division to both individual attributes as well as to the results of aggregator functions. NRQL query chart 11 You can use math with almost any of the other functions covered here to create the perfect chart for viewing your data.  

For more information and support for writing advanced NRQL queries, visit the NRQL documentation and the New Relic forum.


Background image courtesy of

Erica Lauer Vose is manager of New Relic University’s online education team. She brings more than 16 years experience as a trainer and over 10 years experience with instructional design. In 2012, she co-founded a Code School and joined the New Relic University team in 2014. View posts by .

Interested in writing for New Relic Blog? Send us a pitch!