Lightweight Transactions at a Glance

14 min to complete

There are cases when it is necessary to modify data based on its current state: that is, to perform an update that is executed only if a row does not exist or contains a certain value. LWTs provide this functionality by only allowing changes to data to occur if the condition provided evaluates as true. The conditional statements provide linearizable semantics thus allowing data to remain consistent. A basic rule of thumb is that any statement with an IF clause is a conditional statement. A batch that has at least one conditional statement is a conditional batch. Conditional statements and conditional batches are executed atomically, as a Lightweight Transaction (LWT). This session provides an overview of LWT, an example of how it’s used, and a comparison with Cassandra.