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

nrql

#1

Hi

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?


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

#3

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?


#4

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.


#5

@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…


#6

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

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


#7

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?


#8

Exactly… can you advice on this?


#9

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


#10

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?

Ex: www.amazon.in/electronics%


#11

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.


#12

@kavitha We capture several different durations in PageView events. You can read more about this here: https://docs.newrelic.com/docs/insights/insights-data-sources/default-data/browser-default-events-attributes-insights#browser-attributes-table

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 'www.amazon.in/electronics%'

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 'www.amazon.in/electronics%' FACET pageUrl LIMIT 1000


#13

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.


#14

@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 'www.amazon.in/electronics%
UNION
SELECT average(duration) FROM PageView where pageUrl like 'www.amazon.in/clothes%


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

#17

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


#18

You may find the following video helpful in learning how to write NRQL queries: https://learn.newrelic.com/courses/intro_insights/nrql.


#19

@kavitha You could try using FACET cases.

https://docs.newrelic.com/docs/insights/nrql-new-relic-query-language/nrql-resources/nrql-syntax-components-functions#facet-cases-basic

Something like this might work:

SELECT average(duration) FROM PageView FACET cases (WHERE pageUrl LIKE 'www.amazon.in/electronics%' AS Electronics, WHERE pageUrl LIKE 'www.amazon.in/clothes%' 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:

https://docs.newrelic.com/docs/insights/nrql-new-relic-query-language/nrql-resources/nrql-syntax-components-functions


#20

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


#21

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

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