Getting a value: get vs map

Antonio Rohman Fernandez rohman at mahalostudio.com
Fri Jul 29 04:37:37 EDT 2011


  

MapReduce ( or a simply Map ) gets really slow when database has a
significant amount of data ( or distributed over several servers ). Get
instead is always faster as Riak doesn't have to search for the key (
you tell Riak exactly where to GET the data in your url ) 

Rohman 

On
Thu, 28 Jul 2011 23:43:06 +0400, mss at mawhrin.net wrote: 

> Hi,
> 
> (I
looked at various places for the information, however I could not
> find
anything that would answer the question. It's not completely ruled
> out
that not all places were checked though :))
> 
> I use PB erlang
interface to access the database. Given a bucket name
> and a key, the
value can easily be extracted using:
> 
> {ok, Object} =
riakc_pb_socket:get(Conn, Bucket, Key),
> Value =
riakc_obj:get_value(Object)
> 
> Alternatively, a mapred (actually, just
map) request could be issued:
> 
> {ok, [{_, Value}]} =
riakc_pb_socket:mapred(Conn, [
> {Bucket, Key}
> ], [
> {map, {modfun,
riak_kv, map_object_value}, none, true}
> ])
> 
> I would expect that
the result is the same while in the second case, the
> amount of data
transferred to the client is smaller (which might be good
> for certain
situations).
> 
> So the [open] question is: are there any reasons for
using the first
> approach over the second?
> 
> --
> Misha

-- 

 		
[1]

 ANTONIO ROHMAN FERNANDEZ
CEO, Founder & Lead
Engineer
rohman at mahalostudio.com [2] 		 
 PROJECTS
MaruBatsu.es
[3]
PupCloud.com [4]
Wedding Album [5] 

   

Links:
------
[1]
http://mahalostudio.com
[2] mailto:rohman at mahalostudio.com
[3]
http://marubatsu.es
[4] http://pupcloud.com
[5]
http://wedding.mahalostudio.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20110729/d1f18180/attachment.html>


More information about the riak-users mailing list