No query results with large time range

I’m new to InfluxDB and hoping that my problem is a simple newbies mistake. I’m using InfluxDB 2.0.

I have been writing a series of data to InfluxDB at irregular time intervals. Sometimes 10 to 20 minutes apart, other times a couple days apart. The points in the series span about 60 seconds and are approximately 1 ms apart. I would like to be able to query for all of the series of data over a specific time range, say 30 days.

When I try this with the Data Explorer in the Influx UI, I am able to see the older time series, from a little over a week ago, but not the newer data, from a couple of hours ago. As I decrease the time range, I am eventually able to query for the newer data, but only when the range is 24 hours, so I am not able to to query for the older data and have it show up.

The bucket I am using has an infinite retention time and all other configurations are default.

Is this a bug, or have I set up my InfluxDB incorrectly somehow?

I also am using Grafana to visualize the queries and I get the same problem there.

Hello @Cole,
If you query for data from the last 30 days up until now you should be able to see all of you data.
What is your flux query?

Hello @Anaisdg,
Here is a simple query that I use for getting a variable in Grafana. When I use it in the InfluxDB Data Explorer, it also doesn’t work at specific time frames. It works for Past 2d, doesn’t work for Past 7d, and then works again for Past 30d.

from(bucket: "ASL_Test_Bucket")
  |> range(start: v.timeRangeStart)
  |> filter(fn: (r) => r["_measurement"] == "ASL_Test_Processed_Data")
  |> keyValues(keyColumns: ["device_name"])
  |> group()
  |> keep(columns: ["device_name"])
  |> distinct(column: "device_name")

Hello @Cole,
Can you confirm that you have data with that column over the entire range?
What do you mean by it doesn’t work? Long query time? No results? Results exist in raw data view but you’re not able to graph them in the way you want?

Hello @Anaisdg,

By over the entire range, are you asking if there is at least a data point every hour or so, for example, so relatively regularly over the time range? Or are you asking if there is simply a data point within this time range?

The data with this column does not appear over the entire time rage. At the time that I posted this question, the data was basically restricted to a time span of 1 hour over the complete time range. And this occured within 2 days of now(). But there was always at least a single data point with this column in the time range. Even when the time range was Past 7 days or Past 30 days.

By it doesn’t work, I mean that when I set the time range is set to Past 2d, I received results when viewing the Raw Data in the Data Explorer. When I set the time range to Past 7d, I did not receive any results. It simply said on the Data Explorer screen “No Results.”

Hello @Cole,
How can you be sure you wrote a single data point >2 days and <7 days then? How did you write the data point (or few points?). As a test can you do:

import "experimental"
import "array"
  date = experimental.subDuration(d: -5d, from: now())

array.from(rows: [
  {_time: date, _field: "exampleField", _value: 3, foo: "bar"},
|> to(bucket: "test") 

And query for data from the past 7 days? And share the results please?

Finally, what’s the retention policy on your bucket?

Hello @Anaisdg,

Actually, it was also <2 days, not >2 days. I knew this, because I had set the value for time to now(). So at the time, it must have been within the time range Past 2days.
Also, I am able to see the data points when I set the filter time range to Past 2days. But as soon as I set it to something larger, for example Past 7days, it dissappears, i.e. the data explorer gives the response “No Results.” So I know that the data points are there. I am just wondering why the are not found when I change the time range to something longer.

I wrote the data points via python with the influxdb-client.

I attempted this. It worked like it was supposed to. I couldn’t seem to duplicate my problem by writing to a bucket.

The retention is infinite.

How are you confident you wrote the point? If you can’t duplicate the problem by writing a new point…I’m not convinced you wrote a point to begin with?
Are you using OSS? or Cloud?