Question 640 of 982

Quick Answer

The answer is a composite index on (deviceId ASC, timestamp DESC). This indexing strategy directly matches the query’s filter pattern: an equality check on deviceId followed by a range query on timestamp with a descending sort. By ordering the composite index with deviceId first and timestamp descending, Azure Cosmos DB can locate the exact device partition, then scan the timestamp range in reverse order without needing an in-memory sort, drastically reducing Request Units (RU) and latency. On the DP-900 exam, this scenario tests your understanding of how composite indexes optimize multi-field queries, especially when ORDER BY direction matters. A common trap is choosing a default index or a single-field index, which would force a full scan or an expensive sort. Remember the memory tip: “Equality first, then range with direction”—the leading field handles the filter, and the trailing field handles the sort order. This concept is central to any Azure Cosmos DB indexing strategy for efficient queries.

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 smart building company stores sensor data from thousands of IoT devices as JSON documents in Azure Cosmos DB using the NoSQL API. Each document contains fields: deviceId (string), timestamp (datetime), temperature (float), humidity (float), and additional device-specific fields (e.g., motionDetected, CO2level). The most common query is: SELECT * FROM c WHERE c.deviceId = 'sensor-123' AND c.timestamp >= '2025-01-01' AND c.timestamp < '2025-02-01' ORDER BY c.timestamp DESC. Which indexing strategy will provide the best performance for this query?

Clue words in this question

Noticing these words before you look at the options changes how you read each choice.

  • Clue: "best"

    Why it matters: Signals that multiple options may be partially correct. Choose the option that most directly solves the exact problem described, not the one that sounds most complete.

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

Create a composite index on (deviceId ASC, timestamp DESC)

Option B is correct because the query filters on `deviceId` (equality) and `timestamp` (range with ORDER BY DESC). A composite index on `(deviceId ASC, timestamp DESC)` allows Cosmos DB to efficiently locate the partition for the device and then scan the timestamp range in descending order without an in-memory sort, minimizing RU consumption and latency.

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.

  • Use the default indexing policy that automatically indexes all properties

    Why it's wrong here

    The default policy indexes each property individually, which can support equality filters but is not optimal for range queries combined with sorting by timestamp; it may result in a slower execution.

  • Create a composite index on (deviceId ASC, timestamp DESC)

    Why this is correct

    This composite index matches the query predicates: first seeks on deviceId equality, then efficiently performs a range scan on timestamp in descending order, avoiding an in-memory sort.

    Clue confirmation

    The clue word "best" in the question point toward this answer.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Disable indexing for all properties to speed up writes

    Why it's wrong here

    Without any indexes, every query will scan the entire container, causing extremely poor read performance for the given workload.

  • Create a spatial index on the deviceId field

    Why it's wrong here

    Spatial indexes are for geospatial queries (e.g., ST_DISTANCE, ST_WITHIN) and are not helpful for equality and range queries on deviceId and timestamp.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates assume the default indexing policy is sufficient for all queries, but they miss that composite indexes are required to efficiently support queries that combine equality filters on one property with range filters and ORDER BY on another property.

Detailed technical explanation

How to think about this question

Under the hood, Cosmos DB uses a hash-based index for equality filters and a range index for ordered queries; a composite index combines both into a single B-tree-like structure that can serve the filter and sort in one pass. In real-world IoT scenarios with millions of documents per device, this composite index can reduce RU consumption from thousands to single digits per query, and it also avoids the 1,000-result limit on ORDER BY without an index.

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: Create a composite index on (deviceId ASC, timestamp DESC) — Option B is correct because the query filters on `deviceId` (equality) and `timestamp` (range with ORDER BY DESC). A composite index on `(deviceId ASC, timestamp DESC)` allows Cosmos DB to efficiently locate the partition for the device and then scan the timestamp range in descending order without an in-memory sort, minimizing RU consumption and latency.

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.

Are there clue words in this question I should notice?

Yes — watch for: "best". Signals that multiple options may be partially correct. Choose the option that most directly solves the exact problem described, not the one that sounds most complete.

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.