azure - 如何在 azure cosmos DocumentDB 中的查询中读取数据时将 RequestCharge 减少到 1RU

标签 azure azure-cosmosdb

enter image description here enter image description here

我想通过更改查询将 2.28RU 变为 1RU,有人可以帮我吗?

最佳答案

您无法神奇地使查询成本为 1 RU。我很确定您不会能够,因为您正在使用查询引擎。您可以通过仅返回所需的属性(而不是返回 *)来稍微减少 RU。

当您知道自己不会按这些属性进行搜索时,可以通过将属性排除在索引之外,在写入时减少 RU。

但为了降低检索期间的 RU 成本,您需要进行直接读取,而不是查询。这需要 API/SDK 调用,并且无法通过查询浏览器执行。在 C# 中,这看起来像这样;

var response = 
  await client.ReadDocumentAsync(UriFactory.CreateDocumentUri(dbId, collectionId, docId));

然后,您可以检查 response.RequestCharge 以查看 RU 的成本(并且它应该低于查询成本)。

关于azure - 如何在 azure cosmos DocumentDB 中的查询中读取数据时将 RequestCharge 减少到 1RU,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46539530/

相关文章:

azure - CosmosDb SQL 容器的 Bicep 部署在后续管道运行时引发错误

azure - 使用 ADF 时在 cosmos DB 内序列化数组

python - Azure Function App/保存到 Blob 问题 (Python)

Azure管道错误: Could not find any file matching the template file pattern

r - 自定义模块的多个输出

azure-cosmosdb - Cosmos DB 命名约定

azure - 将数据从 SQL 数据库迁移到 Cosmos DB 中如何避免转义字符

azure - DocumentDB 存储过程 Lumenize

asp.net-mvc - Azure 文件存储/索引解决方案

azure - 是否有用于将逻辑应用程序绑定(bind)到 OMS 工作区的 ARM 模板解决方案?