I would like to know if I could use just the update statement form client to insert/update the data into the table instead of using Insert and then update if the key exists. What are the performance problems in using update or insert/update?
In an effort to consolidate free help offered for our products we have decided to move these forums to a more widely used forum. Please use one of the following queries (or any combination):
- Cassandra: tag search or plain text search
- DataStax Enterprise: tag search or plain text search
- DataStax OpsCenter: tag search or plain text search
Update VS Insert(3 posts) (2 voices)
Compare-and-Swap (CAS) operations are coming in C* 2.0 https://issues.apache.org/jira/browse/CASSANDRA-5062 so I think for now you'll have to use either insert or update.
I got that. But If i never use insert and just use update. in my case there wont be people who will be updating same data. The data will be updated/inserted by only one process. Thus I was thinking that I should use update statement directly instead of update.
e.g. insert into tab1 values(1,2)
now update the 2 to 3
update tab1 set col2 = 3 where pk = 1
but to run update i might need to look at the value of pk =1 exists or not. I do not want to do that..
i throught that i use below to insert
update tab1 set col2 = 2 where pk = 1
update tab1 set col2 = 3 where pk= 1 to update
what is the advantages and disadvantges of secodn process