Read before write in cassandra

452 Views Asked by At

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

There are 1 best solutions below

0
On

You could use a composite key in cf1 if there is at least one more column in common. Otherwise the read is unavoidable.

It would be a big performance hit if you are going to get status of different 'order_id' just to update one row. Can't be of more help without actually seeing your data model.