I’m using the Erlang PB interface in my application. The Erlang client gets the keys via this Input/Query in riakc_pb_socket:get_index/4 at https://github.com/basho/riak-erlang-client/blob/master/src/riakc_pb_socket.erl#L677
Input = {index, Bucket, Index, Key}, IdentityQuery = [{reduce, {modfun, riak_kv_mapreduce, reduce_identity}, [{reduce_phase_only_1, true}], true}], My queries can return hundreds of thousands of keys. Transferring all the keys to the client and then doing a length/1 on them is slower than feeding the index query directly into riak_kv_mapreduce:reduce_count_inputs/2 and returning only the sum. I thought there might be a shortcut to avoid mapred altogether. Does the http interface access to some internals not available to a PB client that avoids this mapreduce OR is the HTTP interface doing the same thing as the Erlang client and just doing an index query fed into reduce_identity? -- Jeremy From: Ian Plosker [mailto:i...@basho.com] Sent: Wednesday, January 25, 2012 5:55 PM To: Jeremy Raymond Cc: riak-users@lists.basho.com Subject: Re: Fastest way to count number of items in Secondary Index query Jeremy, Requests to 2i's HTTP interface will return keys rather the objects themselves. You may find better performance counting the returned keys rather than employing a M/R job. -- Ian Plosker <i...@basho.com> Developer Advocate Basho Technologies On Monday, January 23, 2012 at 2:27 PM, Jeremy Raymond wrote: What is the fastest way to count the number of items in a secondary index range query? I'm currently feeding an index input directly into the riak_kv_mapreduce:reduce_count_inputs/2. Anything faster than doing this? Anyway to query an index without loading the objects themselves? -- Jeremy _______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
_______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com