How are the RUs calculated for search based on non-partition key?

Rajeshwar Reddy Chowdepalli 61 Reputation points Microsoft Employee
2023-10-31T05:36:01.6333333+00:00

Let us say I have cosmos DB container for NoSQL API and I am performing search based on the non-partition key like

SELECT * FROM c WHERE c["Complex-Property"]["Property"]="xyzw"

Does the RU consumed depends upon on the size of the container or/and how many documents are retrieved from the container for the query?

To be clear, I have performed the same query on two containers having data of around 2GB and 50GB. The RUs consumed were less in the first case and number of documents falling into that query are also less(verified by checking the count). So I am wondering is it true that the number of RUs consumed is less in smaller container because the number of documents satisfying the query is less or because size of the container is less?

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,543 questions
0 comments No comments
{count} votes

Accepted answer
  1. GeethaThatipatri-MSFT 29,017 Reputation points Microsoft Employee
    2023-10-31T17:07:13.3933333+00:00

    Hi,@Rajeshwar Reddy Chowdepalli Welcome to Microsoft Q&A thanks for posting your question

    The number of RUs consumed by a query depends on the number of partitions that need to be scanned, the number of index terms that are used, and the amount of data that is returned by the query.

    More information https://learn.microsoft.com/en-us/azure/cosmos-db/optimize-cost-reads-writes

    Regards

    Geetha

    0 comments No comments

0 additional answers

Sort by: Most helpful