data-modeling - data modelling in influxdb
问题描述
I would like to take your suggestion on data modelling in influxdb. I have vehicles which are producing a lot of values like soc, odometer, lat, lon etc. I have 2 options that I see as modeling this data in influx
1) Create a single measurement as 'x' with tag as vehicle_id and various fields for this measurement like soc, odometer, lat, lon
2) Create multiple measurement as soc, odometer, lat, lon ... each as a tab vehicle_id
Which one would you prefer and why. I am using first one which seems to be a more natural approach.
解决方案
根据他们的官方文档,测量在概念上是一个表格。字段更像是单一度量下的属性。因为 influxdb 是一个列式数据库,所以记录/点以系列结构组织,其中每个系列都属于一组 db、一个测量值和一个或多个字段,其中一个或多个字段作为标识符。
要回答您的问题,如果您想join
查询多个功能,您应该将它们作为一个或多个字段放在一个单独的度量下;如果它们没有任何互连,那么将它们作为单独的测量值将更易于人类阅读。
此外,理论上,您实际上可以将所有内容放在一个包含数百个字段的单个测量中,并仅使用相关字段进行查询。但这会产生高基数,这会给读/写过程带来压力。您需要通过 influxdb 配置上的批处理和缓存来处理高基数。因此,使用尽可能少的字段会提高读写效率。
推荐阅读
- excel - 如何自动从Excel中的当前行中减去前一行的时间数据?
- postgresql - 使用 Postgres 和 AWS 在一个数据库中的多租户数据库
- laravel - 使用 Eloquent 生成时间序列数据的最有效方法是什么?
- c# - 记录失败的分页列表搜索
- java - 如何在 Java 中删除 HashTable 中的节点?
- php - Slim v4 tuupola / slim-jwt-auth 将自定义令牌发送到中间件
- odoo-14 - Odoo 14 字段过滤器
- c++ - C ++,在使用基类指针初始化派生类的唯一成员后,如何启用对它的访问?
- javascript - 当从 CoinMarket API 获取 SSL 例程的数据时:ssl3_get_record:wrong version number
- python - 尝试刮组仅用于练习。为什么它返回的结果更少?