On 23 Nov 2011, at 08:04, Ben Aviram wrote:
> Hi all,
>
> We’re working on analytics system based on Riak(1.0.2).
>
> I’m storing my data in this structure:
> Key = “userid_date”
> Value = daily report values
>
> So if I want for example to query last year’s data I’m using key-filter like
> this
> {
> "inputs":{
> "bucket":"report"
> "key_filters":[["tokenize", "-", 2],
> ["between", "20110101", "20111231"]]
> },
> }
>
> Are key-filters efficient enough?
Using key-filters mean you're doing a full key list, wish isn't recommended.
Rusty might be able to shed better light on it, but when I did some date based
stuff recently I converted date to a timestamp and indexed it using secondary
indexes _int index, then I could get keys from a range between 2 dates by using
2i range queries. Has to be more efficient than a full key list/key filters. In
fact, on the wiki[1] it suggests dates encoded as sortable strings would work.
[1] http://wiki.basho.com/Secondary-Indexes.html
> Or should I just send a bulk of keys to the map reduce query(ie. userid
> _20110101, userid _20110102, userid _20110103 ….)
>
> Many thanks,
> Ben
>
> _______________________________________________
> riak-users mailing list
> [email protected]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com