Link or Secondary Indexes?
jeff at basho.com
Thu Mar 29 10:52:01 EDT 2012
Neither is better (or worse) for "storing" those bits of information. The question is how you expect to use that data once it is stored. Let's take a look at friend relationships (note: I don't use Facebook, so I might be missing a subtle feature with this example)...
Do you merely plan on following a list of friends to other pages quickly? For example, on your page, you see a list of your friends quickly, be able to click them, and go to their page? If so, the links are quite nice. Links are nice for being able to follow in a query as well. This is a good example of using links to perform link walking:
Or, do you plan on doing reverse lookups by friends? For example, do you want to say "find every who has Tony as a friend" and get a list of users? Note: this is not asking who is a friend of Tony (you'd just lookup Tony and get his list of friends). In this case 2i works nicely, as do other query methods: search, a general MapReduce, etc. But links would be an extremely poor choice.
Does this help? This page might also be applicable to your question:
If you plan on just doing MapReduce queries without 2i, and don't care about link walking, then just storing a typical JSON object and not using either is perfectly fine as well.
jeff at basho.com
On Mar 29, 2012, at 8:29 AM, Buri Arslon wrote:
> While developing my pet project few questions came to my mind and I decided to consult with you.
> Which of them are more effective for recording relationships: Link or Secondary Indexes?
> 1. Friend relationships: like Facebook friends?
> 2. Followed/follower relationships like in Twitter?
> 3. Member/Club relationship like fanpage in Facebook?
> 4. Like in Facebook?
> -- buriwoy
> riak-users mailing list
> riak-users at lists.basho.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the riak-users