StudyToCert

All certifications / AI-200 / Lessons

Microsoft Certified: Azure AI Cloud Developer Associate AI-200 (replaced AZ-204) · Domain 2: Develop AI solutions by using Azure data management services

Partition key design: high cardinality, even spread, point reads; hierarchical partition keys

▶ Watch the overview video

Last reviewed October 6, 2026 · Leer en español

Explain it simpler

Cosmos DB splits your data into many piles so it can grow without limit. The partition key is the label that decides which pile each document goes into, like sorting mail by last name. A good label has lots of different values, so the piles stay small and evenly busy. A bad label, like 'country' when most customers live in one country, puts most of the mail in one pile, and the worker at that pile gets swamped while others sit idle. You pick the label when you create the container, and you cannot change it later without moving all the data. If one customer is so big their pile overflows, you can use a two- or three-part label, like last name plus first name, to split it further.

At Northwind Chat, a fictional messaging startup, Leo is on call when a celebrity joins a public room and invites a million fans. Within minutes, the app logs a wall of HTTP 429 Too Many Requests errors, but only for that one room. The Azure portal says the container is using less than a third of its provisioned throughput. Everyone else's rooms are quiet and fine. Leo's manager asks the obvious question: how can the database be throttling when it has capacity to spare? The answer was decided months ago, in one line of code, when someone chose /roomId as the partition key.

Cosmos DB scales out by partitioning, and understanding the two kinds of partition is the key to every design question. Every item's partition key value places it in a logical partition, which is simply the set of all items that share that value. Cosmos DB then groups logical partitions onto physical partitions, the internal units that each have their own storage and their own share of the container's provisioned throughput. You never manage physical partitions directly; the service splits and moves them as data and throughput grow. What you control is the partition key path, such as /customerId, chosen when you create the container.

Free account

Keep reading for free

Create a free StudyToCert account to read the rest of this lesson: 8 more sections, 6 key terms, a real-world example, an exam tip and self-check questions. Every lesson, lab and practice test is free with an account.

Sign up free Log in

Study AI-200 for free
A week-by-week plan with every lesson, quizzes, checkpoint tests, a practice exam and hands-on labs.
Open the AI-200 study plan