Unique secondary index
jeremiah.peschka at gmail.com
Sun Jul 14 10:38:45 EDT 2013
There's not currently a way to do this that is a pure Riak secondary index
You could, however, rig something up by creating your own indexes in a
separate bucket. In effect, you end up creating your own inverted index.
Since bucket + key combinations must be unique, you can create an
username_index bucket as well as an email-address_index bucket. Assuming
that a user's key is an integer (for the sake of laziness), you would end
up with something like:
username_index/peschkaj : 12345
email-address_index/jeremiah.peschka at gmail.com : 12345
As of today (and to the best of my understanding), it's up to your code to
make sure that a value doesn't exist before writing which means every write
to an index becomes multiple actions against the database (read to check
for existence followed by write), or you'll at least want to make sure your
client sends If-None-Match when you attempt to write new records.
Jeremiah Peschka - Founder, Brent Ozar Unlimited
MCITP: SQL Server 2008, MVP
Cloudera Certified Developer for Apache Hadoop
On Sun, Jul 14, 2013 at 4:17 AM, Sandy Herman <sandyherman at gmx.net> wrote:
> Is it possible to create a unique secondary index?
> E.g.: The "user"-table would need a unique index:
> * username
> * email-address
> Thanks a lot
> riak-users mailing list
> riak-users at lists.basho.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the riak-users