Database Reference
In-Depth Information
DynamoDB data model
Depending upon the features that we want to support, I have listed down the following
tables with their primary keys.
Primary key
type
Table Name
Hash key
Range key
Book
(yop,bkId,..)
Hash and
range
Yop ( Year of Publishing ): This will allow us to retrieve topics as per the year in which
they got published
bkId - unique
book ID
Author (au-
thId,..)
Hash key
authId - unique author ID
NA
Publisher (pub-
Id,..)
Hash key
pubId - unique publisher ID
NA
Here, you will observe that we are using short names such as bkId instead of bookId or yop
instead of YearOfPublishing, as we have learned in Chapter 4 , Best Practices , that even the
attribute name size is being counted while calculating an item. So it is very important to
have all these things in mind before doing the schema design.
Here, while storing the topic data, we are using a unique book ID as hash key and year of
publication as range key. It is always important to have a good choice of hash and range
keys that distributes the load to multiple nodes in the cluster. This helps performance im-
provement.
Sample data for the tables would be like the content of the following screenshot:
Search WWH ::




Custom Search