tag与field区别
tag: 建立索引,不必须,常用作筛选条件
field:不建立索引,必须,不推荐用作筛选条件
概念
_time | _measurement | location | scientist | _field | _value |
---|---|---|---|---|---|
2019-08-18T00:00:00Z | census | klamath | anderson | bees | 23 |
2019-08-18T00:00:00Z | census | portland | mullen | ants | 30 |
2019-08-18T00:06:00Z | census | klamath | anderson | bees | 28 |
2019-08-18T00:06:00Z | census | portland | mullen | ants | 32 |
Timestamp(时间戳)
存储字段_time
,
每条数据都有的列,磁盘上存储精确到纳秒。
写入数据时,需要注意时间戳的精度
Measurement(测量)
存储字段_measurement
,字符串格式
充当temstamp、tags、field的容器
注:便于理解,可以认为是一个表
Fields(字段必须
)
包括字段键_field
、和字段值_value
- Field Key(字段键)
表示字段名称的字符串。
上述例子中,bees
和ants
是字段键 - Field value
表示关联字段的值
支持:string、float、integer、boolean类型
样本数据中的字段值显示指定时间的bees
(蜜蜂数量)23和28,以及指定时间的ants
(蚂蚁数量)30和32。 - Field Set(字段集)
字段集是与时间戳关联的字段键值对的集合。样本数据包括以下字段集
census bees=23i,ants=30i 1566086400000000000
census bees=28i,ants=32i 1566086760000000000
-----------------
Field set
Tags(标签非必须
)
标签包括存储为字符串和元数据的标记键和标记值。
样本数据中,列location、scientist都是标签
不建议讲包含高度可变信息(如 UUID、哈希和随机字符串)设置为标签,这样会导致high series cardinality
(高系列技术),会导致数据库内存负载大幅度增高
- Tag key(标签键)
样本数据中的标签键是location和scientist - Tag value(标签值)
标签键location有两个标签值:klamath和portland。标签键scientist也有两个标签值:anderson和mullen。 - Tag set(标签集)
标签键值对的集合
样本数据包括以下四个标签集
location = klamath, scientist = anderson
location = portland, scientist = anderson
location = klamath, scientist = mullen
location = portland, scientist = mullen
Bucket schema(存储桶架构)
在InfluxDB云中,具有显式模式类型的bucket需要为每个度量提供显式模式。测量值包含标签、字段和时间戳。显式模式约束可写入该度量的数据的形状。
以下是measurement census的架构
name | type | data_type |
---|---|---|
time | timestamp | |
location | tag | string |
scientist | tag | string |
ants | field | integer |
bees | field | integer |
Series(系列)
- series key(系列键)
一个系列键是measurement
(共享测量值)、tag set
(标记集)和field key
(字段键)的点的集合(注意,不包括字段值)
例如,示例数据包括两个唯一的序列键
_measurement | tag set | _field |
---|---|---|
census | location=klamath,scientist=anderson | bees |
census | location=portland,scientist=mullen | ants |
- series (系列)系列键下的集合,包括时间戳、field(value)
一个序列包括给定序列键的时间戳和字段值。
从示例数据中,这里有一个系列键和相应的系列:
# series key(系列键)
census,location=klamath,scientist=anderson bees
# series (系列)
2019-08-18T00:00:00Z 23
2019-08-18T00:06:00Z 28
Point(点)
一个点包括序列键、字段值和时间戳(其实就是一个系列的全值)。
例如2019-08-18T00:00:00Z census ants 30 portland mullen
Bucket(桶)
所有 InfluxDB 数据都存储在存储桶中。
存储桶结合了数据库的概念和保留期(每个数据点保留的持续时间)。
一个桶属于一个组织。
Organization(组织)
InfluxDB组织是一组用户的工作空间。
所有仪表板、任务、存储桶和用户都属于一个组织。
系列键(series key):measurement、tag(key和value)、field(key)相同的集合
系列(serie):系列键下的集合,包括时间戳、field(value)
点(point):包括序列键、field(value)、时间戳; 其实就是一个系列的全值
网友评论