A new way to change a Partition Key in CosmosDB

Artem Mikulich
Level Up Coding
Published in
2 min readApr 9, 2024

--

A Cosmos DB partition key is immutable and cannot be changed. This is not a drama, but it is crucial to remember.

Applications evolve over time, and a solution that was good enough initially may degrade. In the context of Cosmos DB, a wrong partition key can result in cross-partition queries or hot partitions (while others are idle). In turn, cross-partition queries lead to increased RU consumption, response time, and budget. These factors become even more painful if your database is extensive and highly loaded.

--

--

I am a solution architect focused on Azure Cloud. My goal is to unlock business potential by eliminating technological barriers.