Question 1
A financial services company is using Azure Cosmos DB for NoSQL to store transaction data. The container is partitioned by /transactionId. During a performance audit, you observe that queries filtering on /transactionDate are consuming a high number of RUs and are identified as cross-partition queries. The development team wants to add a composite index to improve performance for queries that filter by both /transactionDate and /transactionType. The current indexing policy is the default. What is the most likely outcome of adding a composite index for (/transactionDate, /transactionType)?
Answer and explanation
Correct answer: B
A composite index can optimize the filtering and sorting of cross-partition queries, thereby reducing their RU cost. However, it does not change the fundamental nature of the query. Since the partition key (/transactionId) is not included in the query's WHERE clause, the query must still be fanned out across all partitions to find the relevant documents. The composite index makes the process of finding matching documents within each partition much more efficient.