title: Designing/Using a user table in Cassandra with account creation
body: <p>I'm new to Cassandra and I'm starting off by designing a simple user table for account registration and login purposes. This is pretty simple:</p>
  
  <p>Row key: username; Columns: email, name, password, salt.<br>
  Or alternatively:<br>
  Row key: uuid; Columns: username, email, name, password, salt.</p>
  
  <p>Regarding this simple structure, I've got two questions:</p>
  
  <ol>
  <li>I need an index for the email (and username) lookup. I can use a secondary index or manually create an index. Should I choose the second option because of the high cardinality of the email/username columns? Apparently secondary indexes are intended for low cardinality columns.</li>
  <li>More importantly, I immediately run into the problem of concurrently inserting keys into the table - I need to do a read-before-write to make sure that the username(or email) isn't already in the database. Is there a way to avoid the potential race conditions (e.g. two users registering the same username/email at the same time)? Or is the correct solution to use an additional relational database for handling user registration and copy over user account details to the cassandra database for login and other purposes?</li>
  </ol>