Hi,

That’s how I have done it in many occasions. Nowadays there is the possibility 
use Cassandra 3.0 and materialised views so that you don’t need to keep two 
tables up to date manually:
http://www.datastax.com/dev/blog/new-in-cassandra-3-0-materialized-views 
<http://www.datastax.com/dev/blog/new-in-cassandra-3-0-materialized-views>

Hannu

> On 17 Mar 2016, at 12:05, Bo Finnerup Madsen <bo.gunder...@gmail.com> wrote:
> 
> Hi,
> 
> We are pretty new to data modelling in cassandra, and are having a bit of a 
> challenge creating a model that caters both for queries and updates.
> 
> Let me try to explain it using the users example from 
> http://www.datastax.com/dev/blog/basic-rules-of-cassandra-data-modeling 
> <http://www.datastax.com/dev/blog/basic-rules-of-cassandra-data-modeling>
> 
> They define two tables used for reading users, one by username and one by 
> email.
> ---------------------------------------------------------------------
> CREATE TABLE users_by_username (
>     username text PRIMARY KEY,
>     email text,
>     age int
> )
>  
> CREATE TABLE users_by_email (
>     email text PRIMARY KEY,
>     username text,
>     age int
> )
> ---------------------------------------------------------------------
> 
> Now lets pretend that we need to delete a user, and we are given a username 
> as a key. Would the correct procedure be:
> 1) Read the email from users_by_username using the username as a key
> 2) Delete from users_by_username using the username as a key
> 3) Delete from users_by_email using the email as a key
> 
> Or is there a smarter way of doing this?
> 
> Yours sincerely,
>   Bo Madsen
> 

Reply via email to