DocumentCollection.PartitionKeyRangeStatistics Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a collection of PartitionKeyRangeStatistics object in the Azure Cosmos DB service.
[Newtonsoft.Json.JsonIgnore]
public System.Collections.Generic.IReadOnlyList<Microsoft.Azure.Documents.PartitionKeyRangeStatistics> PartitionKeyRangeStatistics { get; }
[<Newtonsoft.Json.JsonIgnore>]
member this.PartitionKeyRangeStatistics : System.Collections.Generic.IReadOnlyList<Microsoft.Azure.Documents.PartitionKeyRangeStatistics>
Public ReadOnly Property PartitionKeyRangeStatistics As IReadOnlyList(Of PartitionKeyRangeStatistics)
Property Value
PartitionKeyRangeStatistics object.
- Attributes
-
Newtonsoft.Json.JsonIgnoreAttribute
Examples
The following code shows how to log statistics for all partition key ranges as a string:
var collection = await client.ReadDocumentCollectionAsync(
collectionUri,
new RequestOptions { PopulatePartitionKeyRangeStatistics = true } );
Console.WriteLine(collection.PartitionKeyRangeStatistics.ToString());
To log individual partition key range statistics, use the following code:
var collection = await client.ReadDocumentCollectionAsync(
collectionUri,
new RequestOptions { PopulatePartitionKeyRangeStatistics = true } );
foreach(var partitionKeyRangeStatistics in collection.PartitionKeyRangeStatistics)
{
Console.WriteLine(partitionKeyRangeStatistics.PartitionKeyRangeId);
Console.WriteLine(partitionKeyRangeStatistics.DocumentCount);
Console.WriteLine(partitionKeyRangeStatistics.SizeInKB);
foreach(var partitionKeyStatistics in partitionKeyRangeStatistics.PartitionKeyStatistics)
{
Console.WriteLine(partitionKeyStatistics.PartitionKey);
Console.WriteLine(partitionKeyStatistics.SizeInKB);
}
}
The output will look something like that: "statistics": [ {"id":"0","sizeInKB":1410184,"documentCount":42807,"partitionKeys":[]}, {"id":"1","sizeInKB":3803113,"documentCount":150530,"partitionKeys":[{"partitionKey":["4009696"],"sizeInKB":3731654}]}, {"id":"2","sizeInKB":1447855,"documentCount":59056,"partitionKeys":[{"partitionKey":["4009633"],"sizeInKB":2861210},{"partitionKey":["4004207"],"sizeInKB":2293163}]}, {"id":"3","sizeInKB":1026254,"documentCount":44241,"partitionKeys":[]}, {"id":"4","sizeInKB":3250973,"documentCount":124959,"partitionKeys":[]} ]
Remarks
This is reported based on a sub-sampling of partition keys within the collection and hence these are approximate. If your partition keys are below 1GB of storage, they may not show up in the reported statistics.
Applies to
See also
Azure SDK for .NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기