What is the default indexing policy in Azure Cosmos DB?
The default indexing policy includes all possible paths and values.
What are the filters for indexing in Azure Cosmos DB?
- Index seek
- Index scan
- Full scan
Which indexing filter checks for an exact match?
Index seek
The query engine will seek an exact match on a field’s value by traversing directly to that value and looking up how many items match. Once the matched items are determined, the query engine will return the items as a query result.
What is the RU implication for the index seek?
The RU charge is constant for the lookup. The RU charge for loading and returning items is linear based on the number of items.
What happens during Index Scan?
The query engine will find all possible values for a field and then perform various comparisions only on the values. Once matches are found, the query engine will load and return the items as a query result.
What is the RU implication for an index scan?
The RU charge is constant, however it is increased from index seek based on the cardinality of the index properties. The RU charge for loading and returning items is linear.
What happens during full scan?
The query engine will load the items, in their entirety, to the transactional store to evaluate the filters.
What is the RU implication of the full scan?
This type of scan does not uses the index, the RU charge is based on the number of items in the container.
Is eTag property included in the default indexing strategy of the cosmos DB?
No
Your team has written a SQL query for Azure Cosmos DB for NoSQL with the following text: SELECT * FROM c WHERE c.sku = 'RD3387G'. Which lookup method will the query engine use for the sku filter?
Index seek
Which property of an indexing policy should you set to disable all indexing for a container?
Indexing Mode
What is the use of indexing metrics?
Indexing metrics is used to figure out how your index and indexing policy will impact a SQL query.
What is used to create a SQL query in .NET SDK?
We create a variable QueryDefinition with the SQL query. This is then passed on to GetItemQueryIterator<> method of the Container class.
To which class does GetItemQueryIterator method belongs to?
Container
How can indexing metrics be enabled?
To enable indexing metrics, you should first create an object of type QueryRequestOptions and set the PopulateIndexingMetrics to true. This is then passed on to the QueryIterator. The FeedResponse<> object within the while loop contains IndexMetrics string property with information about the Query performance relative to the current index.
What is the default value of PopulateIndexingMetrics?
disabled
Who contains the information about the query performance?
IndexMetrics string property is used to find the query performance with respect to the current index. It is a property of the FeedResponse<> class.
How can we measure the cost of the query?
The QueryRequestOptions class is helpful in measuring the cost of the query. We use RequestCharge property to fetch the cost for each iteration of the query. This is then summed up, to get the final cost of the query.
Which property is used to limit the number of items to be returned in each page, while running q query?
MaxItemProperty of the QueryRequestOptions class.
How can we create an item in the .NET SDK class?
Use the CreateItemAsync method of the container class. The results are stored in ItemResponse<>
Explain the resource property of the ItemResponse variable?
The resource property will output a deserialized instance of your item in the specified generic term. This resource is the item that was recently created server side in azure cosmos db for no sql.
What is the RequestCharge property of the ItemResponse variable?
RequestCharge property returns a value of type double, indicating the number of request units consumed by the operation.
You’re creating a SQL query that will run in the .NET SDK. Which property of the QueryRequestOptions class should you configure to enable viewing recommendations on single and composite indexes along with the impact of utilized indexes?
PopulateIndexMetrics
You’ve created a SQL query in the .NET SDK and received the response in an object of type FeedResponse<>. Which property of the feed response should you use to determine how many request units were used per page of results?
RequestCharge
In what scenarios is integrated cache preferred?
- workloads with far more read operations and queries than write operations
- workloads that read large individual items multiple times
- workloads the execute queries multiple times with a large amount of RU/s
- workloads that have hot partition keys for read operations and queries.
How can integrated cache be enabled?
- Creating a dedicated gateway in your Azure Cosmos DB for NoSQL
- Updating your SDK code to use the gateway for requests
Can we modify the number of sku and nodes in a dedicated gateway after its creation?
Yes
What should be the consistency level of the account for it to use integrated cache?
The client’s consistency level should be set to either session or eventual.
Can the client use the direct mode for connectivity in case of integrated cache?
No. The client must use gateway mode instead of the direct mode.
By default, for how long the cache keeps the data?
By default the cache keeps the data for five minutes.
How can we configure the staleness window of the cache?
By using the MaxIntegratedCacheStaleness property
In the .NET SDK for Azure Cosmos DB for NoSQL, how should you configure the CosmosClientOptions.ConnectionMode property so that your application can use the integrated cache?
Configure the connectivity mode to ConnectionMode.Gateway
Which property of the ItemRequestOptions class should you configure to manually adjust how long items will remain in the cache?
DedicatedGatewayRequestOptions.MaxIntegratedCacheStaleness
Foolishly Yours,
Avantika Tanubhrt
Happy Learning 🙂

Leave a comment