2

We are planning to SQL DB migration to Cosmos DB, as I am new in cosmos I am confused about container. Do we need to take one container for each table or one container is sufficient for all table data ? Suppose we are taking multiple container can we communicate different containers through Store Procedure?

1
  • Typically the migration doesn't just reproduce the relational model in Cosmos. You need to look at how to represent your data in the document model. Commented Feb 4, 2020 at 13:27

1 Answer 1

4
Answer recommended by Microsoft Azure Collective

To be successful here you need to understand how to model data and select a partition key in Cosmos DB. The concepts are very new and different than in a relational database. I would encourage you to read up on the differences as this has a huge impact on performance and cost in this type of database. This content will provide you with a solid understanding of how to design an efficient database that will scale:

(Note: have updated this answer to include more/better content given this answer is gaining traction)

Articles:

Videos:

Microsoft Learn Labs: (Essentially are HOL's for the second video above)

GitHub Repo:

  • Cosmic Works - this is the code and data set for the adventure works talk above

Modeling in Cosmos DB requires you understand your data access patterns, how do I write data, read it and how often for each.

After you have an initial design you will need to test it and measure RU/s consumption to ensure you are fairly well optimized. It doesn't need to be perfect but you should know the answer to whether any cross-partition queries are better served by using ChangeFeed and writing data into another container with a separate partition key.

There are lots of concepts to understand. I know it's a common refrain but I definitely encourage you to read the docs on Cosmos before getting in too deep.

Sign up to request clarification or add additional context in comments.

3 Comments

With links it's important to summarize the information that you feel is important in case the link breaks. Links rot over time and eventually break, and when you do the answer won't make sense without that summarizing information.
Links to Azure docs should never break. We're not allowed to change the URL for a doc without a redirect to its functional equivalent. thanks.
"Should". However servers crash, network connectivity can go down, routes go wonky, etc. Here's the reasoning: meta.stackexchange.com/q/225370/153968. Do what you will with it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.