exam questions

Exam DP-420 All Questions

View all questions & answers for the DP-420 exam

Exam DP-420 topic 1 question 7 discussion

Actual exam question from Microsoft's DP-420
Question #: 7
Topic #: 1
[All DP-420 Questions]

You maintain a relational database for a book publisher. The database contains the following tables.

The most common query lists the books for a given authorId.
You need to develop a non-relational data model for Azure Cosmos DB Core (SQL) API that will replace the relational database. The solution must minimize latency and read operation costs.
What should you include in the solution?

  • A. Create a container for Author and a container for Book. In each Author document, embed bookId for each book by the author. In each Book document embed authorId of each author.
  • B. Create Author, Book, and Bookauthorlnk documents in the same container.
  • C. Create a container that contains a document for each Author and a document for each Book. In each Book document, embed authorId.
  • D. Create a container for Author and a container for Book. In each Author document and Book document embed the data from Bookauthorlnk.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
jfarrell
Highly Voted 2 years, 6 months ago
This is nonsense. Microsoft;s own documentation clearly states that for groups of data with like PKs (and it would be author here) use the same container. C is the answer
upvoted 18 times
...
grada
Highly Voted 2 years, 5 months ago
Selected Answer: A
A is the closest of what I'd model, with a little addon of both books and authors containing collections of not only the authorIds and bookIds (respectively), but also a subset of data from the documents they're referencing (for instance, authorId + authorName, and bookId + bookTitle). https://docs.microsoft.com/en-us/azure/cosmos-db/sql/modeling-data#hybrid-data-models
upvoted 6 times
essdeecee
2 years, 3 months ago
Perfect. A link to the exact example in the documentation for this exact question. Not clear from the question but logically it [u]is[/u] a N:N relationship.
upvoted 4 times
...
...
praticewizards
Most Recent 2 days, 7 hours ago
Selected Answer: C
Rules of thumb, if have many entities, and need performance: 1 container and embed the others. it is C.
upvoted 1 times
...
Blubb1860
11 months, 3 weeks ago
Selected Answer: C
C, is correct. You should not have two separate containers and you want to embed author information in books
upvoted 3 times
...
xRiot007
12 months ago
C - one container for Author and Book and a prop in Book to link the author. An even better solution would be to add dirrectly to the author the list of books, because the most used query is the list of books by author.
upvoted 1 times
rakun
7 months, 1 week ago
"add directly to the author the list of books" - you are assuming stuff here, which is not good. Theoretically, if the author have 1 mil of books, you can create partition distribution skew, hot partition, hit limits and so on
upvoted 1 times
...
...
[Removed]
1 year, 1 month ago
Correct Answer is A
upvoted 1 times
...
azuredemo2022three
1 year, 5 months ago
Selected Answer: C
Selected Answer: C
upvoted 2 times
...
imando
1 year, 8 months ago
Selected Answer: C
C is correct answer
upvoted 3 times
...
Ranzzzan
1 year, 9 months ago
A https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/modeling-data#hybrid-data-models
upvoted 3 times
monniq
1 year, 3 months ago
A suggests for having 2 separate containers. C is in fact the Hybrid data model.
upvoted 1 times
...
...
NickKazen
2 years, 1 month ago
Selected Answer: A
Although it would minimise read operation costs, there is no limit on the number of books authors can write (unfortunately in some cases). Because of that, the size of the actual document can grow enormously. That on its own will cause a huge factor of latency. https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/modeling-data#when-not-to-embed
upvoted 1 times
codingdown
2 years ago
Then what? If the number of books becomes very high, retrieving all the books per Author would require a high effort in both scenario ( A or C) . Having the Author document embedded in the same container would not cause substantial overhead, (only extra operation to do in C would be to filter out the Author document based on property "type" AFTER retrieving all books (N)/ and author (1) documents having same partition key.
upvoted 1 times
...
DirectX
2 years, 1 month ago
"there is no limit on the number of books authors can write (unfortunately in some cases)". I think that this is not the case in real life. The ration is 1:few
upvoted 2 times
...
...
remz
2 years, 3 months ago
Selected Answer: C
C is the most read cost effective
upvoted 2 times
remz
2 years, 3 months ago
i read it back , A is the Right answer!
upvoted 1 times
...
...
ognamala
2 years, 4 months ago
Selected Answer: C
We are explicitly required to minimise cost and latency, A although it would get the job done it would be highly inefficient - the relationship between an author and books is a one to few (1-many but bounded), hence data should be embedded - refer to the below links https://docs.microsoft.com/en-us/azure/cosmos-db/sql/modeling-data https://docs.microsoft.com/en-us/azure/cosmos-db/sql/how-to-model-partition-example
upvoted 5 times
...
jfarrell
2 years, 6 months ago
Sorry I mean't B with a type field
upvoted 1 times
shachar_ash
2 years, 6 months ago
In C you put them in the same container, and embedding to lower the latency
upvoted 2 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...