Differentiate between partition keys & partition key ranges in Azure Cosmos DB

前端 未结 1 1493
臣服心动
臣服心动 2020-12-19 17:20

I\'m having difficulty understanding the difference between the partition keys & the partition key ranges in Cosmos DB. I understand generally that a partition key in co

相关标签:
1条回答
  • 2020-12-19 18:02

    You define property on your documents that you want to use as a partition key. Cosmos db hashes value of that property for all documents in collection and maps different partition keys to different physical partitions. Over time, your collection will grow and you might end up having, for example, 100 logical partition distributed over 5 physical partitions.

    Partition key ranges are just collections of partition keys grouped by physical partitions they are mapped to. So, in this example, you would get 5 pkranges with min/max partition key value for each.

    Notice that pkranges might change because in future, as your collection grows, physical partitions will get split causing some partition keys to be moved to new physical partition causing part of the previous range to be moved to new location.

    0 讨论(0)
提交回复
热议问题