3
votes

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 Collection.

My question: if I choose a Fixed Collection, why am I still prompted to choose a partition key if I will only ever have a single partition?

My guess is that the single partition refers to a single physical partition, but it is still possible to store N logical partitions (each identified by a partition key) within the single physical partition. But if this is correct, I do not see any advantages to choosing a Fixed (10GB) partition over an Unlimited partition aside from the minimum RU/s required for each.

2
Recently (end of November 2017) they changed the Portal so that a fixed-size collection does not prompt for a partition key. Also, apparently the minimum RUs for an unlimited partition is now 1,000 rather than the 2,500 minimum published in the documentation.McGuireV10

2 Answers

6
votes

@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
3
votes

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.