cql - Difference between UPDATE and INSERT in Cassandra? -


what difference between update , insert when executing cql against cassandra?

it looks there used no difference, documentation says insert not support counters while update does.

is there "preferred" method use? or there cases 1 should used on other?

thanks much!

counter columns in cassandra couldn't set arbitrary value: can incremented or decremented arbitrary value.

for reason, insert doesn't support counter column because cannot "insert" value counter column. can update them (increment or decrement) value. here's how update counter column.

    update ... set name1 = name1 + <value>  

you asked:

is there "preferred" method use? or there cases 1 should used on other?

yes. if inserting values database, can use insert. if column doesn't exists, created you. otherwise, insert's effect similar update. insert useful when don't have pre-designed schema (dynamic column family, i.e. insert anything, anytime). if designing schema before hand (static column family, similar rdms) , know each column, can use update.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -