How can you guarantee it's only a single object you'll find?

If you know an event happens every X minutes but don't know the exact
start/stop times, you could truncate the startVal/endVal to the level of
precision you need, hit that directly first and probe either side if you
don't find it.

If I went with a design like that I'd make it so that I could store an
array of readings under the key to tolerate timing issues, or to allow you
to update your collection rate.

Jon




On Fri, Aug 16, 2013 at 6:00 PM, Y N <[email protected]> wrote:

> Hi,
>
> I have a question regarding the most efficient way to perform a search /
> lookup for something. This isn't a typical range lookup (where you want to
> find all objects given a specific range). In this case I want to find
> a specific object where a lookup value falls within that objects range.
>
> My use case is as follows.... I have the following domain object:
>
> MyObj
> startVal (long / number)
> endVal (long / number)
> ..... (other data)
>
> I need to perform many lookups where I need to find a specific domain
> object given a long value that falls within startVal & endVal (inclusive).
>
> What would be the most efficient way to do this in Riak? I can't think of
> a way I could do this via directly lookup, so that only leaves me with 2i
> and search as possible options.
> They seem a bit like overkill, since in this case I am only interested in
> getting back a single object... but there doesn't see to be any other way
> to do this.
>
> Would 2i or search be the most efficient / least impactful way to perform
> this type of search?
>
> Thanks.
>
>
> _______________________________________________
> riak-users mailing list
> [email protected]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>


-- 
Jon Meredith
VP, Engineering
Basho Technologies, Inc.
[email protected]
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to