QuestionQ248

Optimize an Azure Cosmos DB solution

You have an Azure Cosmos DB account named account1 that contains a database named DB1 and a container named Container1. account1 uses the Core (SQL) API.

You have an app named App1 that stores a large volume of data in Container1. The data is partitioned by using the int1 attribute. The items stored in Container1 use the following format.

Question Image

App1 executes the following query.

Question Image

You need to recommend a solution that minimizes the required request units (RUs) for read and write operations. What should you recommend?

  • A Use the default indexing policy.
  • B For DB1, set Throughput to Autoscale.
  • C Configure the indexing policy to include only int1 and exclude string1, string2, and string3.
  • D Configure the indexing policy to include only int1 and exclude all other attributes.
Explanation

An indexing policy that includes only int1 and excludes all other attributes reduces index maintenance and storage, lowering write RU consumption. The int1 partition-key property must be indexed to efficiently serve a query that filters on it; string1, string2, and string3 are only returned by the query and do not need indexes. Microsoft Learn documents that optimizing indexed paths can substantially reduce write latency and RU charges, and that a partition-key property should be explicitly included when using an opt-in indexing policy.

Learn more

Community Discussion

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