bloodynri
bloodynri

Reputation: 603

How do you sample influxdb data at a specified time interval?

I have 'chunks' of data getting stored every 30 seconds. The timestamps on each row of a chunk is the same. The measurements and one of the tags are different. Is there a way to query the data so that I get the data from the last 24 hours but with timestamps of every x mins instead of 30 seconds? I don't need that fine a resolution.

Upvotes: 2

Views: 6087

Answers (1)

Jan Garaj
Jan Garaj

Reputation: 28656

Use GROUP BY time interval:

GROUP BY time(xm)

but you will need to apply some aggregation function on the field, for example MEAN(field) to get average value.

Doc: https://docs.influxdata.com/influxdb/v1.6/query_language/data_exploration/#group-by-time-intervals-and-fill

Upvotes: 4

Related Questions