database schema - InfluxDB : single or multiple measurement -
i'm beginner influxdb , after reading schema design documentation question remain.
how decide if should use 1 measurement multiple fields or multiple measurement single field ?
i have multiple iot device send every datas minute (temperature,humidity, pressure). datas have exact same timestamp.
so wondering if d rather create 1 measurement :
timestamp,iotid,temperature,humidity,pressure ------------------------------------------------- 1501230195,iot1,70, 45, 850
or 3 measurements (one each value) , same tags 1 field in ?
timestamp,iotid,temperature ---------------------------- 1501230195,iot1,70 timestamp,iotid,humidity ------------------------- 1501230195,iot1,45 timestamp,iotid,pressure ------------------------- 1501230195,iot1,850
query-wise, retrieve 1 value 3 @ same time.
there no right or wrong go either schema design going 1 measurement 1 field value more appropriate approach.
why?
storing multiple field values measurement
relational database thing. is, measurement
should not seen database table
different thing.
a measurement should reserved explicitly describing type of data, temperature or cpu usage.
if design our schema using one field value
per measurement
can describe data in real english like;
at point
in time, temperature measured
data value=30
. noticed term used here, point
, data
, measurement
.
whereas if put multiple field values
specific measurement
find difficult present data
in real english.
influxdb
time series database obvious should time-series
way.
also, of time series data measured down precision level of micro-seconds. in such fine grain timing, milliseconds
unlikely set of data share same timing. hence designing 1 measurement containing sequence of data point better choice.
Comments
Post a Comment