Secondary indexes or Riak search ?

Alex Feng sweden.feng at gmail.com
Mon Feb 13 01:18:45 EST 2017


Hi Russell,

In your reply, you mentioned this,

>> There is also the feature that can return the actual riak objects for a
$keys index search,
>>You can pack the index terms with data and return the terms in a query so
that you don’t need a further object fetch (see >>return_terms in docs.)

If I understood correctly, it is possible to fetch object (value) by 2i in
one time. But, we have tried using "return_term = true", it returns the
index with key comparing only key when not using "return_term=true".  It
doesn't help much with extra index, what we want to achieve is to fetch the
object in one time.


Our use case,  client search DB every 10 seconds by 2i, Riak will return a
list of around 5000 results(Keys), then client will query DB to fetch value
for each key, basically it is around 5000 times,  client is easy to run
into some issues most of the time. Any suggestion here ?

Many thanks in advance.

Br,
Alex

2017-02-06 19:02 GMT+08:00 Alex Feng <sweden.feng at gmail.com>:

> Hi Russell,
>
> It is really helpful, thank you a lot.
> We are suffering from solr crash now, are considering to switch to 2i.
>
> Br,
> Alex
>
> 2017-02-06 16:53 GMT+08:00 Russell Brown <russell.brown at icloud.com>:
>
>> It’s worth noting that secondary indexes (2i) has some other advantages
>> over solr search. If you _can_ model your queries in 2i then I'd recommend
>> it.
>>
>> Secondary indexes  have a richer API than is currently documented, if you
>> look at https://docs.basho.com/riak/1.4.7/dev/using/2i/ you’ll see that
>> documents a feature that allows the index terms to be filtered via reg ex.
>> There is also the feature that can return the actual riak objects for a
>> $keys index search,
>> You can pack the index terms with data and return the terms in a query so
>> that you don’t need a further object fetch (see return_terms in docs.)
>> Secondary indexes are written atomically with the object they index.
>> Operationally they don’t require you run a JVM and Solr alongside your
>> riak nodes.
>>
>> You have the tools with basho_bench to answer the question about
>> performance and overhead for your workload. I suspect for “overhead” 2i
>> wins, as there is no JVM-per-node.
>>
>> Modelling for 2i is perhaps harder, in the classical nosql way, you have
>> to do more work upfront when designing your querying.
>>
>> I hope that helps a little. I worked quite a lot on 2i and never really
>> understood why riak-search was seen as a replacment, imo they’re
>> complementary, and you pick the one that best fits.
>>
>> Cheers
>>
>> Russell
>>
>> On 2 Feb 2017, at 09:43, Alex Feng <sweden.feng at gmail.com> wrote:
>>
>> > Hello Riak-users,
>> >
>> > I am currently using Riak search to do some queries, since my queries
>> are very simple, it should be fulfilled by secondary indexes as well.
>> > So, my question is which one has better performance and less overhead,
>> let's say both can fulfill the query requirement.
>> >
>> > Many thanks in advance.
>> >
>> > Br,
>> > Alex
>> > _______________________________________________
>> > riak-users mailing list
>> > riak-users at lists.basho.com
>> > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20170213/c4ad666e/attachment-0002.html>


More information about the riak-users mailing list