question

Expecho avatar image
0 Votes"
Expecho asked AnuragSharma-MSFT answered

Handling large order/orderlines scenarios

We are currently investigating our options regarding the storage options for a new application. Cosmos DB is on our radar and I stumbled upon these docs regarding hierarchical data.

The example uses the order/orderdetails scenario and that model closely relates to our model. But I have some questions about whether cosmos db is still a good fit if the number of orderlines is very large, say 10000 lines. How would that work in terms of updating a select set of orderlines, would we need to read the whole document in memory and how cost effective would such scenario be?


azure-cosmos-db
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

AnuragSharma-MSFT avatar image
0 Votes"
AnuragSharma-MSFT answered

Hi @Expecho, welcome to Microsoft Q&A forum.

Azure Cosmos DB gives us the advantage of having the entire relationship defined in single document as de-normalized data that means embedding all the information into single document which would help us in retrieving everything in single read operation. Now this looks good when we have one-to-few relationship between entities. But if there are lot of entities or ever growing entities then we need to think of alternatives. Reason being retrieving a big document could affect our RUs consumption and thus impacting our cost.

In this case its better to form the weak relationship between documents as mentioned in the below article:

Data modeling in Azure Cosmos DB

This article provides a very nice explanation of multiple scenarios that we could encounter based on Cosmos DB design. I would suggest you to go through it once.

Also how to form the weak links and query them can be referred in below thread:

https://docs.microsoft.com/en-us/answers/questions/571404/index.html

Please let us know if this helps or else we can discuss further on the same.


Please don't forgot to click on accept it as answer button 137322-image.png wherever the information provided helps you. This can be beneficial to other community members as well.



image.png (7.5 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.