CASSANDRA CQL3 : Set value to entire column

Quentin DESBOIS picture Quentin DESBOIS · Aug 5, 2015 · Viewed 8.9k times · Source

For my Cassandra Database, I need to set a value in column for all rows in my table.

I see in SQL, we can do :

UPDATE table SET column1= XXX;

but in CQL (in cqlsh), It doesn't work ! I don't want to update row by row until 9500 rows.

Do you have any suggestion ?

Thank you :)

Answer

hamid147 picture hamid147 · Dec 28, 2015

You can use update query with IN clause instead of executing 9500 query. At first select primary_key from your table and then copy values to this query:

UPDATE table SET column1 = XXX WHERE primary_key IN (p1, p2, p3, ...);