several 2i in the query

Ilyushonak Barys barys_ilyushonak at troika.ru
Fri Aug 3 02:46:29 EDT 2012


Ryan,
Perfect answer! Thank you.

From: Ryan Zezeski [mailto:rzezeski at basho.com]
Sent: Friday, August 03, 2012 10:12 AM
To: Ilyushonak Barys
Cc: riak-users at lists.basho.com
Subject: Re: several 2i in the query

Hi Boris,

My comments are inline.
On Wed, Aug 1, 2012 at 9:01 AM, Ilyushonak Barys <barys_ilyushonak at troika.ru<mailto:barys_ilyushonak at troika.ru>> wrote:
Hi, riak users

I have object with two different secondary indexes - status and type. For example, I would like to query all keys with status=new AND type=gloves.
As wiki says "In version 1.0 of Riak, index queries are only supported on one index field at a time." (http://wiki.basho.com/Secondary-Indexes---Configuration-and-Examples.html)
I would like to know: if anything changed in this field since 1.0?

Nothing has changed in regards to querying multiple indexes.  I.e. only one index can be queried.



I have found the following solutions for this task:
1. Create separate index value for specified pair status and type, for example {<<"index">>, [{<<"status_and_type_bin ">>, term_to_binary({new, gloves})}]}

Do you really want to use term_to_binary here?  Perhaps you could get away with a binary with a known separator like <<"new_gloves">> or <<"new|gloves">> etc.  It should save a few bytes per object over external term format.

2. Use the query result by only one index as map-reduce input pipe and filter values in MR.

If you go this route make sure to query on the more limiting index so MR can process the least amount of objects.  Each object needed by MR is random access.

3. Maybe I think too relational and should use other object structure?

Perhaps, that all depends on your problem.  The data model, how often data is updated, the types of queries you need to perform, how much data you have, what kind of latency requirements you have, etc.  Feel free to elaborate more.

-Z


_______________________________________________________

The information contained in this message may be privileged and conf idential and protected from disclosure. If you are not the original intended recipient, you are hereby notified that any review, retransmission, dissemination, or other use of, or taking of any action in reliance upon, this information is prohibited. If you have received this communication in error, please notify the sender immediately by replying to this message and delete it from your computer. Thank you for your cooperation. Troika Dialog, Russia. 
If you need assistance please contact our Contact Center  (+7495) 258 0500 or go to www.troika.ru/eng/Contacts/system.wbp  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20120803/1c52eb52/attachment.html>


More information about the riak-users mailing list