Getting a value: get vs map

Mikhail Sobolev mss at mawhrin.net
Thu Jul 28 15:43:06 EDT 2011


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20110728/ea1a42bb/attachment.asc>


More information about the riak-users mailing list