question

ImranMondal-3977 avatar image
0 Votes"
ImranMondal-3977 asked Jamie-7931 answered

partition key reached maximum size of 20 gb cosmos db

I have created a Cosmos DB collection with the partition key. Now I'm getting the below error.

Message:

"Errors":["Partition key reached maximum size of 20 GB"]

How to resolve this, Please help.

We have data partition by Device id ( which is coming from IoT hub every second)

azure-cosmos-db
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @ImranMondal-3977, just wanted to follow up on this if you need more details. If answer helped, you can mark it as 'Accept Answer'

0 Votes 0 ·
AnuragSharma-MSFT avatar image
1 Vote"
AnuragSharma-MSFT answered RuoruYandebug-8939 commented

Hi @ImranMondal-3977, welcome to Microsoft Q&A forum.

20 GB is the maximum size a logical partition can grow. If we select a partition key which would make it grow more than 20 GB then we would encounter this issue.

The practical solution to handle this is to design a more granular partition key, that in your case could be combination of device id along with some other properties which would never cross this 20 GB limit.

To make it possible, we need to migrate the existing container into new one and creating the partition key as described above. Below document could help in migration:

Tutorial: Use Data migration tool to migrate your data to Azure Cosmos DB

Please read more on partition key selection:

Choosing a partition key

Please let us know if this helps or we can discuss further on the same.


If answer helps, please mark it 'Accept Answer'




· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @AnuragSharma-MSFT, I have a question. I have two cosmos db env and store same data. but I found that one's vertex and edge count in partition 0 is less than other one, but it's storage is bigger than other one.

Could you please help to solve this? thanks

0 Votes 0 ·
Jamie-7931 avatar image
0 Votes"
Jamie-7931 answered

Hi there,
I came across this page while I was trying to understand the "Partition Key" in Cosmos. Logically speaking, isn't this partition key like the input of the hash function. So the same partition key will be hashed to the same value and therefore will be placed at the same partition.

So speaking of this case where we are using device id as the partition key. Let's assume the device id is UUID based. So it is always 1 device in 1 logical partition. So it will never reach to 20G limit. Am I having the correct understanding of the use of the partition key?

Thanks

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.