I've been told there isn't a schema to store similar measurements which contain reading array index metadata in a time-series database.
Specifically voltage readings from a battery pack which could be viewed as a two-dimensional array of battery packs 0-8 and cells within a pack 0-12. 96 voltage measurements in total.
Having a singular voltages
bucket for which each measurement has tags which contain the indexes packIndex
and cellIndex
and a value of the voltage measurement i.e.
insert voltages,packIndex=2,cellIndex=0 value=3.4000
Allows grouping readings from the same pack index which would be beneficial however storing the indexes as tags means that I am unable to perform operations on those indexes such as SELECT voltages WHERE packIndex < 4
for operations such as find the minimum recorded voltage in pack 3 to 7 etc.
Should I include this index data in a field value however this would mean that I would not be able to group data by a specific field.
My question specifically is should I store array index values as a tag or a field or is there another alternative I am missing.
Is this an uncommon scenario or are there any resources which might be helpful for this problem?
Storing the index data as tag is best for your use case.
In InfluxDB all the tag values are stored as strings. In the InfluxQL queries if we need to filter based on tag values WHERE
clause should use regex. ie.
SELECT voltages WHERE packIndex < 4
should change to
SELECT voltages WHERE packIndex =~ /[1-3]/