2i for single-result lookup

Greg Pascale greg at clipboard.com
Tue Nov 8 13:48:12 EST 2011


Thanks for all the suggestions. 

Let's not worry about the problem of ensuring uniqueness right now - I have that part solved separately.

Rohman, this approach is what I described as a "manual index". It adds a good deal of code that I'm hoping to avoid by using 2i or search. This whole thing is a balancing act between performance, code complexity and to some extent disk space. I'm trying to evaluate which approach gives me the best of all 3.

Manual Index:
  - Adds lots of code complexity
  - Requires only 2 gets look up a user - one to the index to retrieve the primary key, then the lookup of the primary key
  - Not much extra space used.

Search:
  - Barely any extra code
  - Have to index user objects, so about 2x as much space is required
  - Since search uses term-based partitioning, querying should be pretty fast in theory. Write performance will take a hit due to indexing.

2i:
  - Barely any extra code
  - Unsure of amount of extra space required - think it won't be too much
  - Because of document-based partitioning, there is overhead in talking to a coverage set when only one machine will have the result I'm looking for. The significance of this overhead is what I'm really trying to evaluate.

-- 
Greg
Clipboard

On Monday, November 7, 2011 at 8:38 PM, Antonio Rohman Fernandez wrote:

> Instead of using 2i, you could do the following when saving:
> 
> POST http://{IP}:8098/riak/users/rohman
> {"email":"rohman at mahalostudio.com (mailto:rohman at mahalostudio.com)","otherdata":"...."}
> 
> POST http://{IP}:8098/riak/emails/rohman at mahalostudio.com (mailto:rohman at mahalostudio.com)
> {"owner":"rohman"}
> 
> So checking if an email address exists is only a GET http://{IP}:8098/riak/emails/rohman at mahalostudio.com (mailto:rohman at mahalostudio.com) ( and you can even know who is the user owner -> rohman )
> 
> Just you need to create a simple new bucket/key for it... but is worth the effort... not much work... no big key arrays, no loops, etc... instant response ; ) 
> Rohman
> 
>  
> Antonio Rohman Fernandez
> CEO, Founder & Lead Engineer
> rohman at mahalostudio.com (mailto:rohman at mahalostudio.com) 
>  
> Projects
> MaruBatsu.es (http://marubatsu.es)
> PupCloud.com (http://pupcloud.com)
> Wedding Album (http://wedding.mahalostudio.com) 
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com (mailto:riak-users at lists.basho.com)
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20111108/e828b7e7/attachment.html>


More information about the riak-users mailing list