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

Sum up total page load time




I have a product page in my application where i need to calculate the total response time.

For ex: The product page has 1000 product variants, i need to get all the links and the sum up of total page load time duration for all the 1000 links.

Can you suggest nrql for this?

SELECT sum(duration) FROM PageView WHERE pageUrl LIKE '%product%'


I want to calculate the total result in milliseconds.

For ex: If i have 1000 product links and i want to sum up all the 1000 links page load time as a single result not individual one.

Pls suggest nrql for this?


Hi @kavitha - The query that @philweber provided will do exactly as you requested. Add up the durations for all pages where the pageUrl contains product.

You just need to change the LIKE for you scenario. You may also want to look at how to query over time and return more than the default resultset.

Here’ the NRQL reference documentation link.


@stefan_garnham I tried with the above query but what i am getting is the result of individual product link page load time rather than whole products total page load time…


Odd, I just get a whole number. Also, @philweber’s query should actually be:

SELECT sum(duration) FROM PageView WHERE pageUrl LIKE '%product%'


Do you mean you have a product page that has a lot of things that needs to load on the page and you want to know how long the page takes to load with all the bit?

Or do you mean you have a product page that can load one of 1000 different products and you want know on average how long it takes to load the page?

When you look at the attributes available in insights for the page request do you have an attribute the represents the value of the item being represented on the page? Like a product ID? Or does your product page URL contain the product ID in some way?


Exactly… can you advice on this?


If you can tell me more about your URL or an attribute that identifies the product on the page I can help.


Consider an Amazon ecom website where it has a lot of products, in particular, we want to capture the page load time of products/electronics(all the electronics items) page.

  1. Links for all the products/electronics items should display
  2. Individual items page load time in seconds
  3. Average(total duration of all the links in the products/electronics) page load time of all the items listed in electronics categories.
  4. Also need to categorize by devices(Mobile & Desktop)

How can we combine all those in a single nrql query?



If you can literally show a URL pattern for a few products and state the unique attributes you might have I can show you how. The other things you say above are useful, but this is a technical question.

Your ex above is not enough to work out the result.


@kavitha We capture several different durations in PageView events. You can read more about this here:

If you want to the average page load time across all electronics pages, you would query on duration like this:

SELECT average(duration) FROM PageView where pageUrl like ''

This would return an average across all of the pages that match that wildcarded string.

If you want to see average load times for each individual URL, you would add a facet to the query like this:

SELECT average(duration) FROM PageView where pageUrl like '' FACET pageUrl LIMIT 1000


It would be a good idea to also validate the timings and compare pageview duration and webAppDuration to determine which measurement meets your specific needs. They are different and can both be valuable. Also, adding instrumentation to add attributes to pageView will help. Using like can be a problem with complex url patterns. Attributes for product id’s etc can really help long term.


@babbott Its working fine now thanks…

I have another request. Would it be possible to take an average for two pages at a same time?

For Ex: SELECT average(duration) FROM PageView where pageUrl like '
SELECT average(duration) FROM PageView where pageUrl like '

SELECT average(duration) 
FROM PageView 
WHERE pageUrl LIKE '%/electronics%'
   OR pageUrl LIKE '%/clothes%'


I am getting result for only one page not for both.

I want average page load time for both the page

Like: Electronics 6s
Clothes 5s


You may find the following video helpful in learning how to write NRQL queries:


@kavitha You could try using FACET cases.

Something like this might work:

SELECT average(duration) FROM PageView FACET cases (WHERE pageUrl LIKE '' AS Electronics, WHERE pageUrl LIKE '' AS Clothes)

There is a bunch of useful information on the NRQL Syntax page in our Docs that could help you gain more experience writing Insights queries. Check it out here:


@babbott Its working fine now. Thanks for your help.


That makes me happy to hear that @babbott was able to sort you out, @kavitha!

Let us know if you need anything else. :blush: