Reputation: 325
I have been trying to implement a post/replies scenario like google+ in dynamoDB as a private project. This is the first time i am trying to implement a nosql table and am trying to wrap my head around the concept. I understand that related table columns can be embedded into the original table as follows...
Post { userid:1,
postdata: "hello",Comment[
{userid: 2, postdata: "howdy", date: some-date},
{userid: 3, postdata: "higuys", date: some-other-date}
],
date: today}
Now, if this were the way to code the annotated table, it is easy to retrieve by userid and date all the posts and comments for one conversation. But if we need to find a specific comment and update it, is it possible or do we have to 'scan' a table? I have read about scan resulting in results breaking throughput constraints in large data and don't want to use it. Query seem to be limited in operators for comparison and retrieval. So, am i on right path in creating the table this way? I may have to embed other data into table like Audio, video documents and pictures per 'conversation'. Any inputs are appreciated.
Upvotes: 3
Views: 669
Reputation: 1518
In DynamoDB, your entire entity can't be larger than 64kB, so you don't want to embed your comments directly in the post unless you know they will be very small.
It would probably work better to have a list of comment-ids in the post, along with whatever metadata you need to know which ones to retrieve. DynamoDB's low latency means you can have several cycles of request->retrieve->request for every pageload, as long as the number is fixed.
Large embedded content (even larger texts, like blog posts) aren't suitable for DynamoDB, you probably want something like S3 or CloudFront for that.
Upvotes: 4