Write operations
In Cassandra, both UPDATE
and INSERT
statements are write operations, which means that these operation don't do any reading before writing. This implies that, if we're executing an UPDATE
operation on a primary key and the row for that primary key doesn't exist, UPDATE
will insert a new row.
Similarly, if we're performing an INSERT
operation and the row mentioned in the INSERT
operation identified by the primary key already exists in the database, that row will be overwritten by our INSERT
operation.
This is why we call them UPSERT
operations as well.
Note
UPSERT
operations are valid operations in Cassandra and won't throw any errors.
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.