InfluxDB: store data in a single measurement

本秂侑毒 提交于 2019-12-25 04:15:51

问题


InfluxDB ideal way of storing data looks like the following:

* temperature
timestamp,iotid,value
----------------------------
1501230195,iot1,70

* humidity
timestamp,iotid,value
-------------------------
1501230195,iot1,45

* pressure
timestamp,iotid,value
-------------------------
1501230195,iot1,850

How bad is to store data in a single measurement like so?

* data
timestamp,iotid,measure,value
----------------------------
1501230195, iot1, temperare, 70
1501230195, iot1, humidity, 45
1501230195, iot1, pressure, 850

My problem is that I would also need to query the log from date x to date y of all my measures ordered by timestamp, but I can't do it using separate measurements.


回答1:


There is no ideal/recommended way for this question according official doc: https://docs.influxdata.com/influxdb/v1.7/concepts/schema_and_data_layout/. It depends on the use case. Your case makes sense to keep data in one measurement, because they have the same tags, they share also tag values with nice low cardinality + you will have mentioned query issue with multiple measurements.

I have single measurement design in production with ~250M data points (multi node cluster with sharding) and no problem with performance.



来源:https://stackoverflow.com/questions/54449630/influxdb-store-data-in-a-single-measurement

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!