I am new to DynamoDB and I have a big mess: what my tables look like.
I read the posts here: (recommended for those who haven't read it yet) http://docs.amazonwebservices.com/amazondynamodb/latest/developerguide/BestPractices.html
And now I have some dilemmas that I think everyone who starts using DynamoDB will have.
Firstly, my tables: STUDENTS, TEAMS, PROJECTS
STUDENTS : id , age ...
BODIES : id , student-1-id, student-2-id, current-project, prev-project, last-updated-on
PROJECTS : id , team identifier, list of questions, list of students, list of student2answers
some comments:
- As you can see, I do not use the range key. I need? .
- each answer is json (question number, text, insert date)
- Each student can be in several teams.
My dilemmas:
- I want all the teams of a particular student to be updated after a certain date.
Currently, I use 2 scan operations: one search for student1 and a second search for student2.
**Is there a better way ?**
I thought about adding a new table: user-Battles: student-id, team-id so I can request commands for specific students and then batch_get_item all the teams, but what about the latest update? how can i also request this inside batch_get_item?
When a project fails, I don’t use it anymore. what to do with old items? Delete? Move them to another table?
In the project table, the attributes that can be updated are response attributes so I think to move them to another table for presentations.
Do I need to move them if I update them twice? (when student1 sends an answer, and when student2 sends an answer - then the project is old)
* If I create a new table for answers, I will not need to store them in JSON format
How do you design tables? Please let me know.
database nosql amazon-dynamodb database-design
user1623454
source share