Reputation: 903
I am new to Dynamo DB.
I have a table User to store user info and user's music playlist. Music playlist contains a number of mp3 urls. How do I store it in Dynamo DB for efficiency.
My User JSON Design: Key is userid
{
"userid":"",
"shuffle":"",
"folderid":"",
"lastsong:"",
"playlist": [ { "url1", "url2","url3"......100s of urls }]
}
Thanks, Gagan
Upvotes: 0
Views: 82
Reputation: 562
To begin with, I would divide the playlist table into a separate table. In this type of database it is better to have more information than to penalize the speed of reading when making a query or a scan. If your playlist info is only made of Urls maybe in this way it would be fine, as you have shown it, beause you can treat it as a List in any programming lenguage, but if in a future you have to include more info... it will be more complex
The hash key of the playlist table ,if you need in a future to add more info, should be the userid.
Upvotes: 1