Video Transcript (English)
The next step in identifying the workload is to understand how our app will be reading and writing the entities we previously identified.
To recap, a database workload encompasses all the operations a database handles at any particular moment.
So far the database entities we have identified for the bookstore application are eBooks, audiobooks, printed books, authors, publishers, users and reviews
Identifying read and write operations will help us understand what data is accessed together.
We’ll be able to refer back to these findings when we decide which data should be stored together.
Let's consider how our application will interact with our entities in order to identify the read and write operations.
We’ll record our findings in a table which includes four columns.
First, the entities column will track the entities we need to use for the operation.
The Operations column will record what we’re fetching or writing.
Next, the Information column will define the information we need from our entities.
Finally, the type column will record whether the operation is a read or write operation.
We’ll begin with identifying the read operations.
The application is an online bookstore, so a frequent read operation will occur when a user clicks on a book. After clicking, they'll likely want to see book details and reviews.
So we need a read operation to fetch book details, including the average rating.
The ebook, audiobook, and printed book entities all share attributes that contain book details and average rating. For brevity, we’ll just put books in the entities column.
Our application will also give users - the ability to read reviews.
When a user selects a book, our application’s UI will fetch 10 reviews at a time about the book they’ve selected.
This involves a read operation on the reviews entity that fetches ten reviews with their ratings.
Next, we’ll need to account for users who want to view their own information.
For this we’ll need a read operation that fetches the users details from the user entity.
Finally, users will have the ability to visit an author’s page which includes the author’s information and a list of books they’ve written.
This requires an additional read operation that fetches author and book details.
We’ll need to access attributes from both the authors and the ebook, audiobook, and printed book entities, for this operation.
So far we've identified the most common read operations.
Let’s now identify our application’s most common write operations.
We’ll need to add new books and update existing books since we plan to grow our book selection.
To complete this write operation, we’ll need attributes from ebook, audiobook and printed book entities for book details and stock level.
We’ll also need to regularly update the stock of each printed book, to ensure we only sell the inventory we have.
This write operation will need to manipulate the stockLevel attribute from the printed book entity.
Remember that we want to grow to 25 million users in 3 years,
So we’ll need a write operation to add and update users. This write operation will involve the user's entity.
As we have outlined before, users will need to be able to add new reviews on books.
This write operation involves attributes from the review entity including book rating.
So far we have been analyzing the bookstore application from the user perspective but we’ll also need to obtain specific information from our application for business needs.
For instance, the Ops team may need to run various analytical queries. While these queries are important, they don't impact the direct user experience. So optimizing for those is a lower priority.
The Ops team will need to know when the stock for a printed book drops below a certain quantity.
This operation will fetch a list of the printed book titles where the stock level has fallen below 50 so that we can order fresh stock.
This only requires the printed books entity.
Great job! In this video, we defined read and write operations based on the application users and business needs.
Identifying these operations help us define what data needs to be accessed together. We'll use this information in future steps of the data modeling process where we will model relationships and select a relevant schema design pattern.
For now, the critical next step is to quantify the workload by predicting the frequency with which each of the operations will occur.
