Hi Dave. It is correct that listing all the keys in a bucket can be expensive. 
The extent of that expense depends on a few things like the size of your 
cluster (both physical nodes and vnodes), the backend you use, and the amount 
of data you have stored. The $key index can be useful if you are targeting a 
range of keys in the bucket and can be less expensive, but you must specify 
either an exact match key or a range of keys when using it. There is also the 
$bucket index that lets you do the equivalent of listing all the keys in the 
bucket, but it will be just as expensive as a normal key listing and in fact 
the two follow almost identical code paths. Hope this helps shed some more 
light on it for you. Let me know if you have any further questions.

Kelly

On Sep 20, 2012, at 6:22 PM, David Lowell <[email protected]> wrote:

> I've been learning Riak this week, which has been a lot of fun. There sure 
> are a lot of warnings in the documentation about how slow listing all the 
> keys in a bucket can be. However, I would assume that it would be efficient 
> to list the keys in a bucket using the implicit 2i index "$key". Am I wrong?
> 
> I would like to be able to run a map-reduce job over the keys in a bucket, 
> and use key-filtering to select the specific keys I need to operate on. Since 
> most of the documentation examples of key filtering use the entire bucket as 
> the input to the map reduce, we would expect those examples not to scale 
> well. However, since it seems we can reference the secondary index $key as a 
> map-reduce input, that seems like an efficient alternative. Please shoot me 
> down if I'm mistaken.
> 
> Thank you for the help!
> 
> Dave
> 
> --
> Dave Lowell
> [email protected]
> 
> 
> _______________________________________________
> riak-users mailing list
> [email protected]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to