[0.9.0] Ubuntu 14.04 aggregate functions time error
Hi,
When using the aggregate functions, we always end up having a "1970-01-01T00:00:00Z" in the time field.
For example, a query like : select count(name) as counted from demo2
Gives us : time counted 1970-01-01T00:00:00Z 30
Or : select count(nom) as counted from demo2 where time < now() GROUP BY time(1m)
time counted
1970-01-01T00:00:00Z
Gives no result in the "counted" field.
Thanks a lot,
@maxcanada For your first example that behavior is by design. If you specified a GROUP BY clause, the timestamps would be for the beginning of the buckets. Since there is no GROUP BY, the question is what should the timestamp be for COUNT(value)? Should it be the timestamp of the oldest value? The newest value? Right now we just default to 0, or epoch.
I don't see an open issue on this particular topic, I encourage you to open one.
As for your second example your query has no lower bound for the time range. You didn't give a time > XXX. Without any explicit lower bound, InfluxDB uses epoch as the lower bound. There is a maximum of 100k buckets per GROUP BY query. 100k 1 minute buckets starting at 00:00:00 1970-01-01 only gets to early March of 1970 before it runs out of buckets. None of your points are in that range so there are no values to report.
You might ask, "Why doesn't the database just use the oldest point in the series as the lower bound?" In order to determine the oldest point, InfluxDB would have to load every point that matches the conditions and then sort them. That's hugely punitive on RAM and very non-performant. It's not possible to store the earliest point for every possible query because field keys and values are not indexed. If you provide a field in the WHERE clause there is no way to determine what points match without loading them.
Additional details in this mailing list post: https://groups.google.com/d/msgid/influxdb/e871d3ff-2a4d-4597-9180-b124c27bfced%40googlegroups.com
We're building some documentation around these common ways in which InfluxDB is not intuitive. We hope to push those soon.