In mysql a User and Friend Table will somewhat look like these
- User Table
- id
- name
- phone
- status [enabled/disabled]
===============================================
- Friend Table
- user_id
- another_user_id
- status [if friend or not]
===============================================
but in DynamoDb
I have been troubled about these two ways either
Approach 1.
- User Table
- id
- name
- phone
- friends -> attributes
OR
Approach 2.
- User Table
- id
- name
- phone
===============================================
- Friend Table
- user_id
- another_userid
===============================================
Im currently using the Approach 2. question is whats the best way to model tables in cost effective manner , latency and performance?.
PS: I emailed their support about these problems for me but still has no reply from them so someone should already had gone through these problems.
I hope I iterated the question carefully to be understandable.
EDITED: @chen
Q: Do you often query a user's friend list?
A: yes I will query every users-friends-list that will use my software when a user logs in.
Q: Do you wish to know fast how many friends does a user have?
A: No, no need as long as i can get who the users friends are then its all good.
Q: How many friends do you think a user will have?
A: unlimited.
Q: How many users will the system have?
A: unlimited too.
thanks for giving the time.
thanks