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

Get Apache Cassandra Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.