Reputation: 928
I'm experimenting with InfluxDB, and getting the following behaviour:
after creating a few rows with arbitrary content, I pick a time value ts
of a middle row and query: select * from test where time > ts
.
For some reason this returns all rows, including ones that have a lower timestamp. Am I misunderstanding the syntax for time constraints?
As a side note, if I create rows in minute intervals, and use the conditions where time > now() -1m
I do only get the rows created in the last minute.
Upvotes: 1
Views: 1676
Reputation: 5702
From InfluxDB site query language documentation:
Note that the time is a very large number. That’s because it’s a microsecond scale epoch. InfluxDB always stores points at this scale, but most libraries will return the time as either a second, or millisecond scale value. If you’re selecting a specific point, you’ll need to know the exact microsecond scale epoch that point has otherwise you’ll get an unexpected empty result.
Now, using the default web interface that comes with Influx you can see timestamps like 1422883121396
while in the tutorial above you can see 1400497861762723
! The 2nd time-stamp has more digits which are actually the microsecond scale (not full, 3 are shown while there should be 6). Therefore, querying like time > 1422883121396
you are querying for a very old date/time and thus all the results are returned.
Solutions:
Use a library that returns full time-stamps, however, I have never used one so I don't know
If you do not really care about the microsecond accuracy and as a workaround, you can add 000000 at the end of your time-stamp to convert it to the correct scale
There are some applications that might require this precision (for example simulation software) but in most cases #2 workaround should work.
Hope the above solves your problem
Upvotes: 3