Describe considerations for working with non-relational data on Azure →mediumMultiple ChoiceObjective-mapped
DP-900 Practice Question: Describe considerations for working with non-relational data on Azure
A social media application stores user posts in Azure Cosmos DB using the NoSQL API. Each document includes: PostID (unique), UserID, Timestamp, Content. The most common query is: 'Get all posts for a specific UserID, sorted by Timestamp descending.' Which partition key should be chosen to distribute load evenly across physical partitions while also supporting this query efficiently?
⚠ Common exam trap
A common mix-up: candidates choose a unique identifier like PostID (Option A) thinking it guarantees even distribution, but they overlook that the partition key must also match the most frequent query filter to avoid cross-partition queries and high RU costs.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
UserID
UserID is the correct partition key because it evenly distributes write operations across physical partitions (each user has a unique ID) and directly supports the most common query: filtering by UserID. With UserID as the partition key, the query 'Get all posts for a specific UserID, sorted by Timestamp descending' becomes a single-partition query (using the partition key in the WHERE clause), which is efficient and avoids cross-partition fan-out. This design also allows Cosmos DB to use the Timestamp field as a sort key within each logical partition, enabling efficient sorting without additional indexing overhead.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
PostID
Why it's wrong here
Using PostID as the partition key would distribute posts evenly, but the query for all posts of a user would need to fan out across all partitions because posts for the same user would be scattered. This increases RU consumption and latency.
- ✓
UserID
Why this is correct
UserID is the ideal partition key because all posts belonging to the same user are colocated in a single logical partition, allowing the query for a user's posts to be served from one partition with minimal request units and low latency. Since the application has many users, data is spread evenly across physical partitions, preventing hot spots. Additionally, using UserID aligns with the natural query pattern and enables efficient pagination of results.
- ✗
Timestamp
Why it's wrong here
Using Timestamp as partition key often leads to hot partitions because many writes may happen at the same time (e.g., burst of posts), causing throttling. It also does not support the query efficiently because posts for a user would be scattered.
- ✗
Content
Why it's wrong here
Content is unsuitable as a partition key because it is typically a long, variable-length string with extremely high cardinality, meaning each post would end up in its own partition. This would force a query for all posts of a specific user to fan out across every partition, dramatically increasing RU consumption and latency. Furthermore, partition keys based on content do not provide any logical grouping that matches the access pattern, and unpredictable sizes could exceed the 20GB logical partition limit.
Go deeper
Related to this question
Learn chapter
Azure SQL Services
Key term
Azure Cosmos DB
Azure Cosmos DB is a fully managed, globally distributed NoSQL database service that offers fast reads and writes anywhere in the world with automatic scaling and multiple consistency models.
Key term
Partition key
A partition key is a value used by database systems to distribute data across multiple storage partitions, enabling faster queries and efficient scaling.
About these practice questions
Courseiva writes every DP-900 question from scratch — 820 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DP-900 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DP-900 exam.