QuestionQ191

Optimize an Azure Cosmos DB solution

You have the following query.

Question Image

You must recommend a composite-index strategy that minimizes the request units (RUs) consumed by the query. What should you recommend?

  • A a composite index for (sensor ASC, value ASC) and a composite index for (sensor ASC, timestamp ASC)
  • B a composite index for (sensor ASC, value ASC, timestamp ASC) and a composite index for (sensor DESC, value DESC, timestamp DESC)
  • C a composite index for (value ASC, sensor ASC) and a composite index for (timestamp ASC, sensor ASC)
  • D a composite index for (sensor ASC, value ASC, timestamp ASC)
Explanation

Azure Cosmos DB can use a composite index to optimize an equality filter together with one range filter. A composite index can optimize at most one range filter, and equality-filter properties must be listed first. Because value < 22 and timestamp >= 1619146031231 are separate range filters following the equality filter on sensor, the efficient strategy uses (sensor ASC, value ASC) and (sensor ASC, timestamp ASC).

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!