O'Reilly logo

Apache Cassandra Essentials by Nitin Padalia

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Batch statements

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'}, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required