Purpose of a Partition Key for a Cosmos DB Fixed (10GB) Collection

前端 未结 2 1094
轻奢々
轻奢々 2021-01-20 20:07

In the Cosmos DB docs, I see that allocating a Fixed (10GB) Collection means that there will only ever be a single partition allocated to hold documents within the Collectio

相关标签:
2条回答
  • 2021-01-20 20:36

    When we create partitioned collection we are dealing with "logical partitions" not physical ones, the physical partitions is managed by the Cosmos service.

    For "Should I partition my collection?" question, in this blog, you can find:

    • Single-partition collections: have lower price options and the ability to execute queries and perform transactions across all collection data. They have the scalability and storage limits of a single partition (10GB and 10,000 RU/s). You do not have to specify a partition key for these collections. For scenarios that do not need large volumes of storage or throughput, single partition collections are a good fit.
    • Partitioned collections: can span multiple partitions and support very large amounts of storage and throughput. You must specify a partition key for these collection.
    0 讨论(0)
  • 2021-01-20 20:38

    @Rob : When you create a "fixed" 10 GB partition, there is only one physical partition allocated, whether you provide a partition key or not. Note that providing a partition key in this case is optional.

    If you have provided a partition key while creating this "fixed" collection, there is a migration path for this collection to a partitioned collection and you would not have to change your application code.

    If you don't provide the partition key, we don't support migration of this collection to a partitioned collection and hence you will be stuck with 10GB and you would have to manually migrate your data using our data Migration Tool to a new partitioned collection, if you ever cross the 10GB limit. Also, this would require you to change your application code(to pass in the partition key in various APIs) once you start targeting a partitioned collection.

    In summary, you are well off providing a partition key while creating this "fixed" collection, even though all partition key values will be mapped to the single partition.

    Hope that answers you query. Let me know if you have any more comments.

    • Rajesh, Azure Cosmos DB
    0 讨论(0)
提交回复
热议问题