the real question is - if you want the email to be unique, why use
"surrogate" primary key as UUID.

I wonder what UUID gives you at all?

If you want to have non email primary key, why not use md5(email) ?




On Wed, May 7, 2014 at 2:19 AM, Tyler Hobbs <ty...@datastax.com> wrote:

>
> On Mon, May 5, 2014 at 10:27 AM, Ignacio Martin <natx...@gmail.com> wrote:
>
>>
>> When a user registers, the server generates a UUID and performs an INSERT
>> ... IF NOT EXISTS into the email_to_UUID table. Immediately after, perform
>> a SELECT from the same table and see if the read UUID is the same that the
>> one we just generated. If it is, we are allowed to INSERT the data in the
>> user table, knowing that no other will be doing it.
>>
>
> INSERT ... IF NOT EXISTS is the correct thing to do here, but you don't
> need to SELECT afterwards.  If the row does exist, the query results will
> show that the insert was not applied and the existing row will be returned.
>
>
> --
> Tyler Hobbs
> DataStax <http://datastax.com/>
>

Reply via email to