Suggest Cassandra data model for an existing schema

Posted by Andriy Bohdan on Stack Overflow See other posts from Stack Overflow or by Andriy Bohdan
Published on 2010-03-19T18:12:23Z Indexed on 2010/03/20 21:41 UTC
Read the original article Hit count: 416

Hello guys!

I hope there's someone who can help me suggest a suitable data model to be implemented using nosql database Apache Cassandra. More of than I need it to work under high loads and large amounts of data.

Simplified I have 3 types of objects:

  • Product
  • Tag
  • ProductTag

Product:

key - string key
name - string
.... - some other fields

Tag:

key - string key
name - unique tag words

ProductTag:

product_key - foreign key referring to product
tag_key  - foreign key referring to tag
rating - this is rating of tag for this product

Each product may have 0 or many tags. Tag may be assigned to 1 or many products. Means relation between products and tags is many-to-many in terms of relational databases.

Value of "rating" is updated "very" often.

I need to be run the following queries

  • Select objects by keys
  • Select tags for product ordered by rating
  • Select products by tag order by rating
  • Update rating by product_key and tag_key

The most important is to make these queries really fast on large amounts of data, considering that rating is constantly updated.

© Stack Overflow or respective owner

Related posts about cassandra

Related posts about data-modeling