Main use case require us to be able to write about 100,000 records within a 5-15 mins time span which seems to be quite a small task for Aerospike. However, I am going in rounds trying to model the data structure. I will list how I have planned and I would appreciate if anyone can review it.
-
We have users. So I have decided to create a set (Users) as below key | email | name | company | …
-
Users create a Quiz. Each Quiz can have maximum 20 questions each question have 4 possible answers. So I thought to model it including lists in another set (Quiz)
key | question_ownerid | quiz_title | [quiz_rating as a map (1 star = 10, 2 star =5 )] | [list with id of questions] | …
- I thought of keeping questions and respective answers in a separate set (Question)
key | question | [list with 4 answers] | …
each answer has answer | type | is_correct | …
Now these are kind of master data. Now if i delete a question from the set, I will have to do another delete in quiz set’s question id list as well. So first question > is there a trigger or something that I can use to delete the related id from the list since I see couple of use cases where i will have to do two queries to update a record.
The other question is that at one instance, i need to record; quizid | quesion id | answer id | user id, when users start to answer. Maximum will be 100,000 users sending answers in a 15 mins time span.
Do you see anything that is wrong or I can improve?