【发布时间】:2019-04-10 15:19:00
【问题描述】:
我正在将 IoT 数据收集到 Azure cosmos DB。我知道 COSOMOS DB SQL API 是由 Path 自动索引的。我在每个文档中大约有 150 个传感器,大多数 sql 查询都是
DeviceId 已经是分区键
选择 c.sensorVariable From c where c.DeviceId = 'dev1' AND c.time= date1'
{ "DeviceId" : 'dev1' , "time" : 123333 , "sensor1" : 20 , "sensor2" : 40}
我将获取各种传感器数据,但我所有的查询都取决于 deviceId 和 time(在 Unix Timestamp 中)
是否可以对 deviceID 和 time 上的数据进行索引,并排除也在同一路径 / 中的其他键。
并且默认用于收集
"includedPaths": [
{
"path": "/*",
"indexes": [
{
"kind": "Range",
"dataType": "Number",
"precision": -1
},
{
"kind": "Range",
"dataType": "String",
"precision": -1
},
{
"kind": "Spatial",
"dataType": "Point"
}
]
}
],
我觉得 DataType String 不应该是 Hash 类型的索引而不是 Range 吗?这个精度是多少:-1
在 Azure cosmos DB 文档示例中,我看到字符串的精度为 3,我不明白为什么?
如果我有 100 台设备并且每秒钟放置一次数据,那么哪种类型的索引更好?
【问题讨论】:
-
您好,我的回答对您有帮助吗?
-
部分是杰,但它有助于获得知识
标签: azure azure-cosmosdb azure-cosmosdb-sqlapi