I am trying to build a query that will restrict how much data can be queried. For example I only want to allow a user to be able to query ATMOST 24hrs worth of data at a time. However, I want them to be able to select from the time filter accordingly. For example, a user can query from 4/15/19 - 4/16/19, but can’t query from 4/15/19 - 4/17/19. I am primarily interested in this as it will increase performance as the query will be cut-off at the 24hrs. It is also worth mentioning that I am using grafana. Is this even possible to do? Thanks to all of those who reply in advance.
I’m a little confused by your question. Would something like this be what you’re looking for:
SELECT "usage_user" FROM "telegraf"."autogen"."cpu" WHERE time >'2019-04-16T00:00:00Z' - 24h AND "cpu"='cpu-total' FILL(null)
That allows you to specify the absolute start time with the relative time.
Hello @Anaisdg thanks for the response! What I am really trying to do is allow a user to only be able to select 24h’s of data at a time given a start (and end date?). Is something like this possible to do? I was thinking perhaps just have the user be able to pick a time range from the time filter, but if the range exceeds 24 hours from the starting time, any data after the 24h’s won’t be shown, regardless if the user selected a range that bounds from day 1 to day 3. (Where, to reiterate, I would only want the user to see data from day 1, up until 24hrs, in which then it would be cut off)
The above query does allow you select only 24hs of data at a time given a start date. You can input any start date you want and use the relative time of -24 h to limit the window. Any data after that would be cut off.
Hmmm I must be doing something wrong. This is what I have as my query but I am not getting any results.
from what i can see in the upper right corner of your screen you are querying data from 4 till 5 februari …
Is that what you intend to do ?
@MarcV Yes but the upper bound (Feb 5th) should not matter. I am really only interested in selecting a start time from the time filter, and then displaying 24h + from the selected starting time.
Maybe it is the blank/space in “CAT 1” ?
I see now that it is an alias ,
the query will return no result because it would rather be something like this ?
select usage_idle as “cat 1” from cpu limit 4