Removing all rows from a Cassandra cql table

Is there a command for all rows present in the cql table in cassandra, as in sql?

delete from TABLE 

Following the documentation, I cannot find a way to perform the delete operation without the where clause.

 DELETE col1 FROM SomeTable WHERE userID = 'some_key_value'; 
+51
cassandra cql
Aug 25 '14 at 9:55
source share
1 answer

To remove all rows from a CQL table, you can use the TRUNCATE command:

 TRUNCATE keyspace_name.table_name; 

Or, if you are already using a keyspace that contains your target table:

 TRUNCATE table_name; 

It's important to note, but by default, Cassandra creates a snapshot of the table just before TRUNCATE. Be sure to clear the old snapshots or set auto_snapshot: false to your cassandra.yaml.

+92
Aug 25 '14 at 13:48
source share



All Articles