【发布时间】:2019-06-10 17:31:52
【问题描述】:
为了调整 CosmosDB for MongoDB API 的性能,我需要获取集合中的分区数。
这样做的天真方法是查询分区键的所有不同值,如下所示(在 C# 中):
var results = await SomeCollection.Distinct<string>("PartitionKey", filter: "{}").ToListAsync();
但当然,这需要查看每一个文档或至少扫描整个索引并以Query exceeded the maximum allowed memory usage of 40 MB. Please consider adding more filters to reduce the query response size... 失败。
我也看过PartitionKeyRangeStatistics,但明确指出If your partition keys are below 1GB of storage, they may not show up in the reported statistics,
这适用于大多数分区。
关于如何获得集合中分区的准确计数的任何想法?
【问题讨论】:
标签: c# azure azure-cosmosdb