Blog riak design

Jeff Kirkell jeff.kirkell at
Wed Mar 7 12:41:14 EST 2012


I apologize in advance as I tend to write daily long replies. You have a
couple options and I can provide some of the insight I have learned up till
now but confusing answer is you can do both of what you wrote.

You can have a bucket which is just called posts that also contains the
comments or threads of comments (bad example as this could nest) like so

{data : "'name':'My Blog Post', 'detail':'my long blog post information',
'comments': [{'from': 'someone', text:'test'}], {'from': 'someone else',
'text': 'more comments'} "}

As long as you can format it, you can store it. In talking with people that
deal with large amounts of data who are general NoSQL experts (Cassandra
which is also a Dynamo derivative) they strongly push to not keep
relationships in the same object. I will say that it really depends on what
you are trying to do since, if you just have simple data, it is fine.

The better approach is to have a separate bucket called "posts" and another
called "comments" You can then use secondary indexes as an option to link
the two together. Basically, you take the unique identifier of the post
object and you make it a index header so you can get the comments based on
the post object. With the comments bucket, I would probably just store the
chain of comments together so if someone replies the a comment, all that
goes into the actual comment's object instead of having to manage some form
of hierarchy data.

At the end of the day I basically built a solution that uses both of your
original options at the same time.

Hopefully that provides some insight into the flexibility.


On Wed, Mar 7, 2012 at 12:03 PM, Buri Arslon <buriwoy at> wrote:

> I have another crazy idea :) What if I create a bucket for each blog's
> comments? So, riak/blog_bucket/blog_01 and comments go to
> riak/blog_01_comments?
> Any ideas?
> -- Buriwoy
> On Tue, Mar 6, 2012 at 10:07 AM, Buri Arslon <buriwoy at> wrote:
>> Hi,
>> I'm very new to NoSQL/KV database systems. Sean's webinar "Schema Design
>> for Riak" gave me some idea about how to move
>> to kv database, but I feel I need some more advice/docs to fully grasp this
>> new concept for me.
>> I was thinking about developing a blog application using Riak. Which
>> schema would be most effective for that kind of application (regular blog:
>> content + comments):
>>   bucket_blogs -> blog content;
>>   bucket_blogs_comments -> comments for the blogs in the bucket_blogs
>> or,
>>   bucket_blogs -> JSON("blog": <<blog content>>, "comments":
>> <<comments>>)?
>>  The second option seems less effective if number of comments grow
>> significantly. But I'm not sure. Any hints? Ideas?
>> Thanks!
>> -- Buriwoy
> _______________________________________________
> riak-users mailing list
> riak-users at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the riak-users mailing list