Understanding partition keys in Azure Cosmos DB
A partition key is a property of a document in Cosmos DB that is used to determine the physical partition in which the document is stored. When you create a container in Cosmos DB, you specify a partition key for that container. Cosmos DB then uses the partition key to distribute documents across multiple logical partitions based on the value of the partition key.
Figure 8.3 – Partition key in Cosmos DB
For example, let’s say you have a container called orders
in Cosmos DB, and you want to partition your data by customer ID. You can specify the customer ID as the partition key when you create the container. Cosmos DB will then use the customer ID to distribute orders across multiple physical partitions based on the value of the customer ID.
Currently, in Azure Cosmos DB, logical partitions have a maximum size limit of 20 GB. This limit is a “hard” limit, meaning that once reached...