It is advisable in cassandra to do data modeling around queries. However if I model set a column as clustering column for the purpose of sorting based on it and if that object is dynamic, because it is clustering column, I cannot update its value since it belongs to primary key now for that table. In that case, two options are
- Sorting on client side (which is bad)
- Delete complete row and insert new row (which will create tombstone)
Is there other valid way of achieving this in Cassandra data modeling?
Eg. I have table_A and for query of getting all rows with a particular state, table_A_by_state. However since state will be dynamic, and you will need to update state in table_A_by_state which comes with options I mentioned above. Has someone else faced same problem or is there other way of data modeling for this problem?
table_A: Columns: id (K), name, state
table_A_by_state: Columns: id (K), state (C), name