Partition Key

From Ilianko

← Back to DP-420 Terminology Reference

Category: Data Modeling & Partitioning

Summary: Property used to distribute items across physical partitions for scalability.

Overview

A partition key is a JSON property (or path) chosen for each item in a container that Azure Cosmos DB uses to distribute data across physical partitions for scalability, and to route requests efficiently. Choosing an appropriate partition key — one with high cardinality and even access/storage distribution — is one of the most critical design decisions in Azure Cosmos DB for NoSQL, directly affecting cost, throughput distribution, and query efficiency.

[Image: dualPartKey.jpeg]

More Info & Links

DP-420 Style Practice Questions

Q1. What is the primary purpose of a partition key in Azure Cosmos DB?

  • A. Distributing data and requests across physical partitions for scalability
  • B. Encrypting data at rest
  • C. Defining the container's indexing policy
  • D. Setting the default consistency level

Q2. What characteristic should a good partition key generally have?

  • A. High cardinality with evenly distributed access patterns
  • B. Low cardinality with only a few possible values
  • C. The same value for every item in the container
  • D. A value that changes on every write

Answer Key

Answers are listed at the very end so you can attempt the questions first.

  • Q1 (Partition Key): A. Distributing data and requests across physical partitions for scalability — The partition key determines how data is distributed across physical partitions, which is central to scalability.
  • Q2 (Partition Key): A. High cardinality with evenly distributed access patterns — A good partition key has many distinct values and spreads read/write load evenly, avoiding 'hot partitions'.

DP-420: Designing and Implementing Cloud-Native Applications Using Microsoft Azure Cosmos DB — term detail page