Getting random objects filtered by a set of criteria

Sean Cribbs seancribbs at gmail.com
Sat Jan 9 11:10:31 EST 2010


If your bucket is small-to-medium, I would list keys in the bucket and 
select a random key from that list.  You'd likely want to cache that 
list if it gets very big, or move on to a custom M/R job if the bucket 
gets even larger.

Sean

On 1/9/10 11:01 AM, Dmitrii Dimandt wrote:
> I want to show the user a photo to vote for. This has to be a random photo from those he hasn't voted for yet.
>
> In a prior conversation Kevin Smith suggested[1] I use M/R for such a task. Well, not only do I have to understand how to write such a M/R :) I also need to know whether  it's ok to run such a query on every page request.
>
>
> [1] http://twitter.com/kevsmith/status/7557173117 , http://twitter.com/kevsmith/status/7557206025
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>    





More information about the riak-users mailing list