Azure Cosmos DB: How to Do Partition Merge?

Arwin Lashawn
6 min readJun 5, 2023

Need a bit of guidance from someone who has executed, monitored, and confirmed the effectiveness of partition merge even after going through the official doc on partition merge? You have come to the right place.

Note: The term “partition” from here onward refers to physical partitions, unless stated otherwise. If you do not know the difference between physical and logical partitions yet, read this first.

In this piece, you will understand my environment before partition merge, how I executed partition merge, and further, how I verified that the partition merge was indeed effective in reducing number of partitions.

For reasons why one would be so keen to reduce the number of partitions, I plan to visit that in a separate article.

Disclaimer

For the purpose of this article, I did not use an environment which simulates typical production-level workloads. Nevertheless, this should serve as an excellent baseline.

Depending on my availability/demand, I may write a follow-up article on executing partition merge on tougher conditions which simulate a “typical” production workload, say 30+ physical partitions, presence of hot partitions, requests actively hitting the database, etc.

--

--

Arwin Lashawn

Data & AI @ MSFT Azure | Level 2 Seller @ FVRR | Learn to write, write to learn | Enjoy my writing? Feel free to follow : )