Containers & Partitions
Azure Cosmos DB containers and partitions
An Azure Cosmos DB container is where data is stored. Unlike most relational databases which scale up with larger VM sizes, Azure Cosmos DB scales out.
Partitions
Data is stored on one or more servers, called partitions.
To increase throughput or storage, more partitions are added.
This relationship provides a virtually an unlimited amount of throughput and storage for a container.

Partition key
When a container is created, you need to supply a partition key or a shard key.
The partition key is a property you select from your items to help Azure Cosmos DB distribute the data efficiently across partitions.
The value of this property is then used to route data to the appropriate partition to be written, updated, or deleted.
The partition key can also be used in the WHERE clause in queries for efficient data retrieval.
Logical partition can store up to 20GB of data.

Schema agnostic
Containers are schema agnostic. Items within a container can have arbitrary schemas or different entities so long as they share the same partition key. For example, an item that represents a customer and one or more items representing all their orders, can be placed in the same container!
Last updated