My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Cassandra data modeling

prathamesh juvatkar's photo
prathamesh juvatkar
·Jan 10, 2017

There are some issues with cassandra data modeling I encountered when you have to model your dataset around queries. Here is one example:

I have a dataset where each row has a name and a state. State is dynamic so it changes with time. One query is just to get row by name so name would be partition key for that table. My other query is to get all rows belonging to a state. For this query, I need to have a table where state is partition key. Now when state changes, I need to update this table but udpates on partition key are not possible so I need to delete and insert again which will cause tombstones. Also every time I need to change state of object given a name, I need to get older state with a read query on first table so that I can delete row in second table since state is partition key. To all cassandra experts, am I doing data modeling incorrectly here?