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.