exam questions

Exam DP-420 All Questions

View all questions & answers for the DP-420 exam

Exam DP-420 topic 4 question 8 discussion

Actual exam question from Microsoft's DP-420
Question #: 8
Topic #: 4
[All DP-420 Questions]

You have an application that queries an Azure Cosmos DB Core (SQL) API account.
You discover that the following two queries run frequently.

You need to minimize the request units (RUs) consumed by reads and writes.
What should you create?

  • A. a composite index for (name DESC, timestamp ASC)
  • B. a composite index for (name ASC, timestamp ASC) and a composite index for (name DESC, timestamp DESC)
  • C. a composite index for (name ASC, timestamp ASC)
  • D. a composite index for (name ASC, timestamp DESC)
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️
You should customize your indexing policy so you can serve all necessary ORDER BY queries.
ORDER BY queries on multiple properties:
The following considerations are used when using composite indexes for queries with an ORDER BY clause with two or more properties:
* The composite index also supports an ORDER BY clause with the opposite order on all paths.
* If the composite index paths do not match the sequence of the properties in the ORDER BY clause, then the composite index can't support the query.
* The order of composite index paths (ascending or descending) should also match the order in the ORDER BY clause.
Consider the following example where a composite index is defined on properties name, age, and _ts:

Reference:
https://docs.microsoft.com/en-us/azure/cosmos-db/index-overview

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
azuredemo2022three
Highly Voted 1 year, 6 months ago
Selected Answer : C
upvoted 5 times
...
xRiot007
Most Recent 12 months ago
Here is a better link for you to put in the Solution: https://learn.microsoft.com/en-us/azure/cosmos-db/index-policy#order-by-queries-on-multiple-properties
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...