QuestionQ81

Design and implement data models

HOTSPOT -

You are creating a database in an Azure Cosmos DB Core (SQL) API account. The database will support an application through which users can share online posts. Users can also submit comments on other users’ posts.

You must store the data shown in the following table.

Question Image

The application has these characteristics:

  • Users can submit an unlimited number of posts.
  • The average number of posts a user submits will exceed 1,000.
  • Posts can receive an unlimited number of comments from different users.
  • The average comments per post will be 100, but many posts will have more than 1,000 comments.
  • Users can have no more than 20 interests.

For each of the following statements, select Yes if the statement is true. Otherwise, select No.

Yes or No
StatementsYesNo
If you embed the posts data into the users data instead of creating a separate document for each post, you will increase the write operation costs for new posts
If you embed the comments data into the posts data instead of creating a separate document for each comment you will increase the write operation costs for new comments
If you embed the interests data into the users data instead of creating a separate document for each interest, you will increase the read operation costs for displaying the users and their associated interests
Explanation

Azure Cosmos DB request-unit charges for writes depend on item size. Appending unbounded posts or comments to an embedded parent makes the parent item grow and raises the cost of subsequent writes (and can eventually encounter the item-size limit). A user’s interests are bounded at 20, so embedding them with the user permits retrieving the user and interests together in one read instead of issuing reads for separate interest documents.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!