Haseena Parkar
Haseena Parkar

Reputation: 979

Azure Cosmos DB Partition

I have a collection which will store 8 million records monthly in cosmos collection which comes to 5GB of data monthly.

I want to allow a partition key datewise. So the question is, should I keep the partition key as Year_Month or dividing it further to Year_Month_Day?

How many logical partitions are supported by cosmos db? is there any limit to it

Upvotes: 0

Views: 113

Answers (1)

Nick Chapsas
Nick Chapsas

Reputation: 7200

There is no limit to the logical partition in Cosmos DB. It will keep on scaling and splitting those underlying physical partitions to support as many as you need.

The only limitation is that each logical partition can hold up to 10GB of data. Once that amount is reached you can not add more data in this logical partition and you have to migrate in a collection with a different key.

So with that in mind the decision should be like this.

Will you ever have 10GB worth of documents with the same Year_Month value? If not then that should be your partition key. If yes then you should widen the scope and add day in there. Again, will you ever have 10GB worth of documents with the same Year_Month_Day value? If yes then you need a different key definition.

Upvotes: 3

Related Questions