localdata01
localdata01

Reputation: 657

cassandra should I use update or insert for updating?

I heard I should avoid a lot of updating statements and delete statements. Can I use insert instead of update if I want to update a row ?

Upvotes: 0

Views: 1160

Answers (1)

Manish Khandelwal
Manish Khandelwal

Reputation: 2310

Update operation is basically insert in Cassandra. In fact every write operation (Insert, Update and Delete) is insert only. As Cassandra is append only database, so new entry is inserted into database.

You need to understand why it is recommended to avoid too many updates and deletes in Cassandra. Basic reason is that your reads become slow with too many updates or deletes.

Cassandra writes(insert,update,delete) its data in immutable SSTables. With many updates(or inserts) and deletes your partition is present in multiple SSTables until compaction takes place. So to give you complete data Cassandra has to read all SSTables and then return the merge data.

Upvotes: 1

Related Questions