Courseiva

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. Each post has fields: PostID (unique), UserID, Timestamp, Content, LikesCount. The application frequently queries for all posts by a specific UserID ordered by Timestamp descending. To minimize Request Unit (RU) consumption, which partition key and indexing strategy should be used?

⚠ Common exam trap

The trap here is that candidates often pick a partition key based on the ORDER BY column (Timestamp) without realizing that the filter column (UserID) should be the partition key to avoid cross-partition queries, and that a composite index is needed to avoid an expensive sort.

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

Partition key: UserID, and create a composite index on (UserID, Timestamp DESC)

UserID is the most frequently filtered attribute, making it an ideal partition key to distribute data evenly and avoid cross-partition queries. Adding a composite index on (UserID, Timestamp DESC) allows the query to be served from a single physical partition with an index seek, minimizing RU consumption by avoiding a full scan or sort operation.

Answer analysis

Option-by-option breakdown

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

  • Partition key: UserID, and create a composite index on (UserID, Timestamp DESC)

    Why this is correct

    This design localizes all posts for a user in one partition and uses an index that directly supports the filter and sort order.

  • Partition key: Timestamp, and sort by UserID in the query

    Why it's wrong here

    Partitioning by Timestamp spreads a single user's posts across many partitions, causing expensive cross-partition queries.

  • Partition key: PostID, and use ORDER BY Timestamp

    Why it's wrong here

    Partitioning by PostID scatters data randomly; queries for a specific user would hit many partitions, increasing RU consumption.

  • Partition key: UserID, and use ORDER BY PostID

    Why it's wrong here

    Ordering by PostID does not sort by Timestamp, which is the required order. Additional sorting would be needed.

About these practice questions

This DP-900 question is part of Courseiva's 820-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.