Question 102 of 982

Quick Answer

The answer is userId, as it is the optimal partition key for user session data in Cosmos DB. This choice directly aligns with the core principle of partition key selection: the key should be the property most frequently used in queries and must provide high cardinality for even data distribution. Since the application frequently queries by userId to retrieve all sessions for a particular user, using userId ensures all session documents for that user reside in the same logical partition, making these queries both efficient and fast by avoiding cross-partition fan-out. On the Microsoft Azure Data Fundamentals DP-900 exam, this scenario tests your understanding that a partition key must balance query performance with scalability; a common trap is selecting sessionId because it is unique, but that would scatter each session across partitions, hurting the primary query pattern. Remember the memory tip: “Query first, then partition” — always choose the key your app filters on most, not just any unique field.

DP-900 Practice Question: Describe considerations for working with non-relational data on Azure

This DP-900 practice question tests your understanding of describe considerations for working with non-relational data on azure. Match the stated requirement to the specific cloud service, access model, or configuration option — many options are valid in isolation but not for this scenario. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

A development team is designing an application that stores user session data in Azure Cosmos DB. Each session document contains a sessionId (unique), userId, timestamp, and a JSON field 'metadata' that can include various optional properties. The application frequently queries by userId to retrieve all sessions for a particular user. Which property should be chosen as the partition key to optimize query performance and ensure even data distribution?

Question 1mediummultiple choice
Full question →

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

The partition key should be the property most frequently used in queries and that provides high cardinality for even distribution. Since the application frequently queries by userId to retrieve all sessions for a user, choosing userId as the partition key ensures that all session documents for a given user are stored in the same logical partition, making these queries efficient and fast. Additionally, userId typically has a large number of distinct values, which promotes even data distribution across physical partitions.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • sessionId

    Why it's wrong here

    Using sessionId as partition key would make each document its own partition, so queries by userId would become cross-partition queries, scanning many physical partitions and increasing latency and RU consumption.

  • userId

    Why this is correct

    userId is the most common filter, and using it as partition key allows queries for a specific user to be routed to a single partition, offering fast and efficient reads.

    Related concept

    Read the scenario before looking for a memorised answer.

  • timestamp

    Why it's wrong here

    Timestamp can cause hot partitions if many sessions occur simultaneously, and it is not the primary query filter, leading to unnecessary cross-partition scans.

  • metadata

    Why it's wrong here

    metadata is a JSON field with varying properties; it is not guaranteed to exist in all documents and cannot serve as a stable partition key for query routing and distribution.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates often choose sessionId because it is unique, not realizing that a high-cardinality key that is not used in queries leads to inefficient cross-partition queries, while a key like userId balances query efficiency with distribution.

Detailed technical explanation

How to think about this question

Under the hood, Azure Cosmos DB uses the partition key to hash and distribute documents across physical partitions; queries that include the partition key in the filter are routed directly to the relevant partition, avoiding a fan-out. A common real-world scenario is a multi-tenant application where each user's sessions are isolated; using userId as the partition key also naturally supports transactional operations within a user's partition. The choice of partition key directly impacts RU consumption and latency, making it a critical design decision for performance and cost.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A cloud solutions architect for a retail company is evaluating services for a new workload. The correct answer here reflects best practice for the specific scenario described — not a general cloud recommendation. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Cloud exam questions reward reading the constraint carefully: the same technology can be right or wrong depending on the use case.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related DP-900 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free DP-900 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this DP-900 question test?

Describe considerations for working with non-relational data on Azure — This question tests Describe considerations for working with non-relational data on Azure — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: userId — The partition key should be the property most frequently used in queries and that provides high cardinality for even distribution. Since the application frequently queries by userId to retrieve all sessions for a user, choosing userId as the partition key ensures that all session documents for a given user are stored in the same logical partition, making these queries efficient and fast. Additionally, userId typically has a large number of distinct values, which promotes even data distribution across physical partitions.

What should I do if I get this DP-900 question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 11, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.