Sort by secondary index

Андрей Хомяков ahomyakov at 2reallife.com
Wed May 23 11:02:12 EDT 2012


Hello!

I'm trying to sort objects in riak by secondary index. Is it possible?

I've read some sources and understood, that standard map-reduce function
for key-sort (reduce_sort in riak_kv_mapreduce.erl)  orders list in memory.
Such approach can be applied to ids, but not the best way for sorting data.

In classic map-reduce model we work with key-value pairs, whitch are
grouped and ordered by key after map step on each map node, so on the
reduce step we have an ordered set of keys with value-sets. In the Riak map
phase returns a plain array of values and the reduce phase works with
concatenated array, produced by all mappers. So we can apply sort only on
reduce phase on large data.

Is there any fast and distributed way to sort data by fields not on reduce
step and not after select?

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20120523/50be82ae/attachment.html>


More information about the riak-users mailing list