I’m trying to use InfluxDB to store data from several sensors (~5-10) sampled at around 200Hz on a Raspberry Pi.
I get the feeling that storing 1 data point per sample would be overkill, and for instance it would make more sense to store 1 second worth of data, timestamped with just the first sample’s timestamp.
I was wondering if there was some best practice to store data in (variable-length) chunks instead.
I found the following post for storing periodic images, which is somewhat similar to what I’m trying to achieve, except that I woud have to encode/decode this data somehow (e.g. base64, hex, etc…), whereas I’d like to have some way of getting some homogeneous view instead.
Any thoughts? Is there some way to coalesce adjacent data points, so that they don’t get individually timestamped and are therefore stored together?
Thank you!
Each measurement in InfluxDB is a timestamp combines with a set of tags and a set of fields. Tags are anything that you might want to “group by”—types of sensors, location, etc. Fields are the values of the measurement you want to store. You can store multiple values in a single measurement using fields. For example, if you have three sensors, s1, s2, and s3, you could have a field for each one. This is what line protocol for a single measurement with a tag “location” of value “north” and three values:
pisensors,location="north" s1=0,s2=2,s3=4
Since I didn’t include a time value, the measurement would be automatically timestamped by the database.
Encoding multiple sensor values into a single field is not how InfluxDB is intended to operate. As you say, you’d need to encode/decode the data somehow and you’d lose much of the functionality of the database.