Question - Using ItemRequestOptions to Override Consistency
See original GitHub issueIf our database is configured for session level consistency and I would like to override that on a per read (query) using the ItemRequestOptions
, am I able to go up to strong?
Or am I forced to create a stored procedure to do the read?
Thanks,
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (5 by maintainers)
Top Results From Across the Web
azure - Cosmos DB - consistency level override for query
If they match the data is consistent. If they do not match, the item with the greater LSN is returned as it is...
Read more >Manage consistency levels in Azure Cosmos DB
Clients can override the default consistency level that is set by the service. Consistency level can be set on a per request, which...
Read more >Understanding Consistency Levels in Azure Cosmos DB
Cosmos DB provides 5 levels of consistency rather than just 2 extremes. Each level comes with availability and performance trade-offs, but ...
Read more >Understanding Consistency Levels in Azure Cosmos DB
Cosmos DB has the advantage over other distributed databases by providing us with 5 defined levels of consistency rather than just 2 extremes....
Read more >Use consistency models in Azure Cosmos DB SQL API
... level for an Azure Cosmos DB account - Change the consistency level on a ... 42:09 - Change consistency model with the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
you bet. mjbrown <at> microsoft <dot> com
It is not possible to set a stronger level of consistency than what is set in the account at the session level, it can only be relaxed.
Users should generally avoid using stored procedures for read operations because they only operate on the primary replica. This can become a bottleneck in very heavy read scenarios. The passage referred to above regarding strong consistency is intended for write-scenarios as there is guidance on not using stored procedures for read scenarios.
Overall there is no reason to use a stored procedure in this way if you are in the same session within an application. Session level consistency provides in-session strong consistency. You will always read your own writes. If you have multiple instances of an application or separate apps in the same region, if you are able to pass the session token between them you can also get strong consistency within that region.
Hope this helps.
#please-close