nerdexam
Microsoft

DP-420 · Question #9

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…

The correct answer is A. Create a container for Author and a container for Book. In each Author document, embed bookId. In Cosmos DB, the guiding principle is to model data around your most frequent access pattern. The dominant query is 'list all books for a given author.' Creating a container for Author and a container for Book, and embedding the list of bookIds (or full book subdocuments)…

Design and implement data models

Question

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 for NoSQL that will replace the relational database. The solution must minimize latency and read operation costs. What should you include in the solution?

Exhibit

DP-420 question #9 exhibit

Options

  • ACreate a container for Author and a container for Book. In each Author document, embed bookId
  • BCreate Author, Book, and Bookauthorlnk documents in the same container.
  • CCreate a container that contains a document for each Author and a document for each Book. In
  • DCreate a container for Author and a container for Book. In each Author document and Book

How the community answered

(38 responses)
  • A
    71% (27)
  • B
    5% (2)
  • C
    8% (3)
  • D
    16% (6)

Explanation

In Cosmos DB, the guiding principle is to model data around your most frequent access pattern. The dominant query is 'list all books for a given author.' Creating a container for Author and a container for Book, and embedding the list of bookIds (or full book subdocuments) within each Author document, means a single point read or efficient partition-scoped query retrieves all books for an author in one round trip. This eliminates cross-partition joins and minimizes both latency and RU cost. Storing Author and Book in the same container with a link document (option B) introduces unnecessary complexity, and separate containers without embedding (option D without denormalization) requires multiple reads.

Topics

#Data Modeling#Denormalization#Embedding#Performance Optimization

Community Discussion

No community discussion yet for this question.

Full DP-420 Practice