Database Reference
In-Depth Information
DynamoDB data model
Depending upon the features we want to support, I have listed down the following tables
with their primary keys:
Table name
Primary key type
Hash key
Range key
Topic ( Name, ... )
Hash key
Name
NA
Question (TopicName, Question,..) Hash and range keys TopicName Question
Answer(Id, AnswerTs)
Hash and range key Answer Id Answer timestamp
Votes(AnswerId, ..)
Hash key
Answer Id
The previous table gives the kind of data we want to store and retrieve for the users. Here,
the Topic table would contain all the topics we have in our application. Here, we have only
the hash key for this table. The Question table would have both hash and range keys, that
is, TopicName and Question, respectively. Here we can save information for questions like
the description, the identity of the one who has added that question, and so on.
The Answer table stores the information about the answers given by users. Here, we have
the timestamp at which the user has added the answer as the range key. Keeping the
timestamp as the range helps equal data distribution across the cluster.
Finally, we have also kept one table that lists the votes one has gathered for the answers
given. Sample data for the given tables would look like the following tables:
Topic table
{
"name": "Cloud Computing",
"createdAt": "23-06-2011T13: 00: 05Z",
"description": "This topic is for all Cloud Computing related questions."
"subscribers" : 24455
}
{
"name": "Big Data",
"createdAt": "23-07-2011T13: 00: 05Z",
Search WWH ::




Custom Search