DP-203 Design and implement data storage Practice Question
Your company uses Azure Cosmos DB for NoSQL to store user profiles. The application frequently reads profiles by user ID (the partition key). Occasionally, the application needs to query by email address, which is not part of the partition key. What should you do to optimize the occasional queries by email?
⚠ Common exam trap
A common mix-up: candidates assume a secondary index is unnecessary or that changing the partition key is the only way to optimize non-key queries, but Azure Cosmos DB supports secondary indexes for non-partition key fields, and altering the partition key would disrupt the primary access pattern.
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
✓
Create a secondary (composite) index on the email field.
Creating a secondary index on the email field allows Azure Cosmos DB for NoSQL to efficiently serve queries filtering by email without scanning all partitions. Since email is not the partition key, a secondary index (specifically a composite index if needed for multi-field queries, or a single-field index) enables index-based lookup across all physical partitions, optimizing the occasional query without redesigning the data model.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Create a secondary (composite) index on the email field.
Why this is correct
A secondary index allows efficient queries on non-partition key fields.
- ✗
Change the partition key to the email field.
Why it's wrong here
This would hurt the primary workload that queries by user ID.
- ✗
Denormalize the data by storing a copy of the email in the partition key.
Why it's wrong here
Unnecessary if a secondary index exists.
- ✗
Use the Azure Cosmos DB change feed to maintain a separate container keyed by email.
Why it's wrong here
The change feed tracks inserts and updates to trigger downstream actions, but it does not support querying the source container by email—it only replicates data to another container, which would then require separate indexing and query logic. This option is tempting because change feed is commonly used to maintain denormalised or secondary-index containers for alternate query patterns, such as when you need to support lookups on a non-partition-key field in a different container.
Go deeper
Related to this question
About these practice questions
One of 760 original DP-203 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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-203 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-203 exam.