C# 为什么Cosmos upserts的插入成本是原来的两倍?
我创建了一个全新的集合,并应用了一个选择退出索引策略C# 为什么Cosmos upserts的插入成本是原来的两倍?,c#,azure-cosmosdb,C#,Azure Cosmosdb,我创建了一个全新的集合,并应用了一个选择退出索引策略 { "indexingMode": "consistent", "automatic": true, "includedPaths": [ { "path": "/path/to/included/property/?" }, { "path": "/path/to/root/of/multiple/included/pro
{
"indexingMode": "consistent",
"automatic": true,
"includedPaths": [
{
"path": "/path/to/included/property/?"
},
{
"path": "/path/to/root/of/multiple/included/properties/*"
}
],
"excludedPaths": [
{
"path": "/*"
},
{
"path": "/\"_etag\"/?"
}
]
}
然后,我向它编写了两次基本文档(使用container.UpsertItemAsync()
)
为什么第二次写入的花费几乎是RUs的两倍?Azure CosmosDB中的RUs被计算为执行操作时使用的
内存+CPU+IOPS
的一个因子。
在更新文档时,它需要首先获取文档,然后更新并将其插入到集合中。因此,更新文档的成本较高
Inserting document: {"id":"foo","PartitionKey":"bar"}
RequestCharge = 5.52
Updating document: {"id":"foo","PartitionKey":"bar"}
RequestCharge = 10.29