Tarzan
Tarzan

Reputation: 529

Data modeling on cassandra?

I have an email marketting project, after long time researched, I decided to use cassandra to store my data.

My business is to allow my customers to create campaign, then import users from my users database, then send an email to them. After receive our email, the user maybe do some actions (open, view item, buy, complain, unsubscribe ...), I will log this actions based on its campaign.

My data structure is :

This is my first time with cassandra, I've searched and read many source from google but was still confusing about how my data modeling.

Update: my queries

I need to do the below queries:

  1. List all campaigns in system
  2. List all campaigns for a customer
  3. Insert the action log whenever user did an action on a campaign
  4. List all users in a campaigns with the actions that they did, including the occurred time for each action (as a table, with paging)
    • The columns is actions
    • Each row is an user
    • Each cell is the occurred time for action on user

Please give me an idea or introduce some articles for me on how to model my data?

Thanks very much.

Upvotes: 0

Views: 133

Answers (1)

Chiron
Chiron

Reputation: 20245

In Cassandra, you model your tables according to your queries; not to the relation between your entities. This means duplicated data is ok, normal and encouraged. Remember, there are no relations between your tables.

So if your query is about listing all campaigns that belong to a customer, this means that your 'customer' table should contains denormalized data. The same goes to rest of your queries.

Upvotes: 3

Related Questions