DP-201 Exam QuestionsBrowse all questions from this exam

DP-201 Exam - Question 43


You are designing an Azure Cosmos DB database that will contain news articles.

The articles will have the following properties: Category, Created Datetime, Publish Datetime, Author, Headline, Body Text, and Publish

Status. Multiple articles will be published in each category daily, but no two stories in a category will be published simultaneously.

Headlines may be updated over time. Publish Status will have the following values: draft, published, updated, and removed. Most articles will remain in the published or updated status. Publish Datetime will be populated only when Publish Status is set to published.

You will serve the latest articles to websites for users to consume.

You need to recommend a partition key for the database container. The solution must ensure that the articles are served to the websites as quickly as possible.

Which partition key should you recommend?

Show Answer
Correct Answer: B

The partition key for the Azure Cosmos DB database should be Category + Created Datetime. This is because no two stories in a category will be published simultaneously, ensuring uniqueness within a category and enabling efficient data retrieval. Using Category in the key means articles can be grouped by their category, which helps in serving the latest articles quickly. Additionally, Created Datetime provides a unique identifier for each article within a category, facilitating efficient querying without ever requiring changes to the partition key. Headline and Publish Status are not suitable as they can change over time, and Publish Date + random suffix would not adequately ensure efficient partitioning.

Discussion

2 comments
Sign in to comment
anamaster
Apr 18, 2021

and the publish status and headline will change

hello_there_
Aug 9, 2021

And publish date as well, from null to some value. Changing partition keys is not allowed, so only possible answer is B

cadio30
May 24, 2021

the propose solution is correct. Publish datetime is not an option here as the partition key should be in string or integer