cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bo Finnerup Madsen <bo.gunder...@gmail.com>
Subject Re: Data modelling, including cleanup
Date Mon, 11 Apr 2016 06:00:07 GMT
Hi Hannu,

Thank you for the pointer. We ended up using materialized views in
cassandra 3.0.3. Seems to do the trick :)


tor. 17. mar. 2016 kl. 11.16 skrev Hannu Kröger <hkroger@gmail.com>:

> 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
>
> Hannu
>
> On 17 Mar 2016, at 12:05, Bo Finnerup Madsen <bo.gundersen@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
>
> 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
>
>
>

Mime
View raw message