Why are all writes in Cassandra considered upserts, and what does that mean for INSERT versus UPDATE?
Last updated
Cassandra never reads before writing: it just appends timestamped cells, so
INSERTandUPDATEboth create the row if absent or overwrite it if present (an upsert).So
INSERTsilently overwrites a duplicate key,UPDATEcreates a missing row, and conflicts resolve by last-write-wins on timestamp.Real differences remain: only
INSERTsets a row liveness marker and supportsIF NOT EXISTS, whileUPDATEsupportsIF EXISTSand counter/collection ops (LWT forms do read first via Paxos).
- https://www.red-gate.com/simple-talk/other/understanding-data-modifications-in-cassandra/
- https://axonops.com/docs/data-platforms/cassandra/cql/dml/insert/
- https://medium.com/@HobokenDays/cassandra-commands-unveiled-exploring-the-nuances-of-update-insert-39fdb06eadb0
- https://goodspace.ai/interview-questions/cassandra
- https://www.youtube.com/watch?v=Y-vY49lDeKY
- https://docs.datastax.com/en/cql-oss/3.3/cql/cql_reference/cqlUpdate.html
- https://cassandra.apache.org/doc/4.1/cassandra/cql/types.html