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

How to select certain hours every day in NR Insights?


Is possible, for example to select a response time only from 5am to 6am every day in the query

SELECT percentile(duration * 1000, 95) AS ‘Response time’ FROM Transaction WHERE (name = ‘WebTransaction/login (POST)’) From 5am to 6am TIMESERIES SINCE 1 day ago COMPARE WITH 1 week ago EXTRAPOLATE


Hi, @Di.Feng: Try WHERE hourOf(timestamp) = '05:00'.


Hi, any use of hourof, monthof, etc results in a NaN error. As simple as “SELECT monthOf(timestamp) FROM SyntheticCheck” does not work. “SELECT timestamp FROM SyntheticCheck” works just fine. Using these date functions in a where clause same results. Any ideas?



Hi, @beheer: Generally, the hourOf(), monthOf(), etc. functions are used to facet a value by time or day, for example:

SELECT average(duration) 
FROM SyntheticCheck 
FACET hourOf(timestamp) 
SINCE 1 week ago

Can you provide some more information about what you are trying to accomplish?



What I am trying to do is filter results by time of day. I have results from all day, and want to filter out the results from busy hours. So someting like Select someting from Syntheticcheck where hourOf(timestamp) In (10,11,12).


Unfortunately, I think my reply above is incorrect: I don’t think you can use the result of a function in a WHERE clause.


Could I use it in a filter somehow?


Ah, correction: You can use hourOf(timestamp) in a WHERE clause, but the hour is a string. Try this:

SELECT average(duration) 
FROM SyntheticCheck 
WHERE hourOf(timestamp) IN ('10:00', '11:00', '12:00') 
SINCE 1 day ago