Links vs Key Filters for Performance
aphyr at aphyr.com
Thu May 5 18:51:59 EDT 2011
I suppose if you had a really small number of keys in Riak it might be
faster, but you're almost certainly better off maintaining a second
object and making the lookup constant time. Here's an example:
On 05/05/2011 03:49 PM, Andrew Berman wrote:
> Ah, that makes sense. So is it the case that using the link
> implementation will always be faster? Or are there cases where it makes
> more sense to use a key filter?
> On Thu, May 5, 2011 at 3:44 PM, Aphyr <aphyr at aphyr.com
> <mailto:aphyr at aphyr.com>> wrote:
> The key filter still has to walk the entire keyspace, which will
> make fetches an O(n) operation as opposed to O(1).
> On 05/05/2011 03:35 PM, Andrew Berman wrote:
> I was curious if anyone has any thoughts on what is more performant,
> links or key filters in terms of secondary links. For example:
> I want to be able to look up a user by id and email:
> *Link implementation:*
> Two buckets: user and user_email, where id is the key of user
> and email
> is the key of user_email. User_email contains no data but
> simply has a
> link pointing back to the proper user.
> *Key Filter:*
> One bucket: user, where id_email is the key of the bucket. Lookups
> would use a key filter tokenizing the id and then looking up the
> id or
> email based on the proper token.
> Obviously both work, but I'm curious what the implications are
> from a
> performance standpoint.
> riak-users mailing list
> riak-users at lists.basho.com <mailto:riak-users at lists.basho.com>
More information about the riak-users