gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 07:48:46 25 4
gpt4 key购买 nike

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com