Cassandra supports the execution of multiple INSERT
/ UPDATE
/ DELETE
operations in a batch. This way, client programs can save the time it takes to send queries multiple times to the server. In versions above 1.2, default batch statements are atomic. This means either all the statements of a batch will be completed or none will. Statements inside a batch are not isolated. So, if a batch is being executed and has completed some of the statements inside it, then a parallel running client can read those changes. However, updates belonging to a partition key are isolated:
BEGIN BATCH INSERT INTO cars (brand, model, variant , body_type, colors, mileage) VALUES ( 'Audi', 'Q1', '3.0 TDI QUATTRO', 'Sedan', {'Apple Green', 'Titanium Black'}, 14.2); UPDATE cars SET body_type = 'Sedan' WHERE brand='Audi' AND model ='Q7' AND variant = '3.0 TDI QUATTRO PREMIUM PLUS'; APPLY BATCH;
Atomicity comes at some performance cost. To avoid it, UNLOGGED
batches could be used. These batches will...