Hi Antonio,

Yes, a Secondary Index query is much faster than using a bucket input or key
filter. This is one of the reasons why we built Secondary Indexes, so this
is definitely a recommended use case.

Behind the scenes, the bucket input or key filter must examine all keys in
the system to pick out matching keys. Some backends do this more efficiently
than others, but in the general case it's an expensive operation in terms of
CPU and possibly disk, and not one we recommend you run frequently.

A Secondary Index query, on the other hand, simply needs to read from the
index. This operation generally takes a few disk seeks, less if that section
of disk is cached in memory, and it is an operation you can run within web
response time.

Best,
Rusty

On Tue, Oct 25, 2011 at 2:14 AM, Antonio Rohman Fernandez <
roh...@mahalostudio.com> wrote:

> **
>
> Hi all,
>
> I remember a previous discussion in the mailing-list about doing mapreduce
> over an entire bucket '{"inputs":"products","query":[...]}' being very slow
> independently of how many items that bucket would have stored in as Riak
> would have to scan all memory in search for the keys, etc... so... how about
> secondary indexes? are they a good alternative? faster? slow too?
>
> if I want to get all products with category "sport" using secondary indexes
> like this:
> http://xx.xx.xx.xx:8098/buckets/products/index/category_bin/sport
> => {"keys": ["productA","productB",...,"productN"]}
>
> Will the keys array come in an speed-decent result? or wouldn't it be
> recommended?
> Thanks,
> Rohman
>  [image: line]  [image: logo] <http://mahalostudio.com>   *Antonio Rohman
> Fernandez*
> CEO, Founder & Lead Engineer
> roh...@mahalostudio.com   *Projects*
> MaruBatsu.es <http://marubatsu.es>
> PupCloud.com <http://pupcloud.com>
> Wedding Album <http://wedding.mahalostudio.com>  [image: line]
>
> _______________________________________________
> riak-users mailing list
> riak-users@lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>


-- 
Rusty Klophaus

*Basho Technologies, Inc.*
11921 Freedom Drive, Suite 550
Reston, VA 20190
www.basho.com
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to