BATCH (CQL)
Groups multiple CQL statements into one request. Useful for writing to denormalized tables atomically. UNLOGGED is faster for multi-partition writes but not atomic across partitions.
Syntax
cassandra
BEGIN [UNLOGGED] BATCH
statement;
APPLY BATCH;Example
cassandra
BEGIN BATCH
INSERT INTO following (follower_id, followed_id) VALUES (?, ?);
INSERT INTO followers (followed_id, follower_id) VALUES (?, ?);
APPLY BATCH;