question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question - Using ItemRequestOptions to Override Consistency

See original GitHub issue

If 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:closed
  • Created 4 years ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
markjbrowncommented, Nov 8, 2019

you bet. mjbrown <at> microsoft <dot> com

1reaction
markjbrowncommented, Nov 8, 2019

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found