Read before write in cassandra

时间:2015-06-25 19:01:12

标签: cassandra data-modeling

We have a scenario where we have to query on status and also update it sometimes in cf1. As we need to query so I kept the column in primary key (avoiding indexes as status has only 4 distinct values in it ) . We have order_id and status( not included in primary key here) in another columnfamily (cf2). we have to keep both cfs in sync so we are using batch statements. So if we have to update status in cf2 then to get that row we have to get the status from cf1 everytime. will that be a performance issue as it can be considered as read before write in cassandra which is anti pattern. Thanks.

1 个答案:

答案 0 :(得分:0)

如果共有至少一个列,则可以在cf1中使用复合键。否则,阅读是不可避免的。

如果要获得不同的“order_id”状态只是为了更新一行,那将是一个很大的性能影响。如果没有真正看到您的数据模型,就无法提供更多帮助。