The Cassandra Truncate command is used to delete all records from the table also removes any materialized views associated with the table. Once we fire the Truncate command, the JMX command is executed on all nodes of Cassandra and deletes the SSTables data related to the table. In case any node is not responding or down then Cassandra sends the message "Unable to complete request: one or more nodes were unavailable."


Truncate Table

The Cassandra Truncate command will delete all rows from the table as mentioned above.

Let's take an example to delete all records from the table Cloudduggu.emp_name that we have already created. The following is the content of the table Cloudduggu.emp_name.


cassandra select command cloudduggu


Syntax:
TRUNCATE  TABLE  keyspace_name.table_name ;

We will use the below Cassandra Truncate command to delete all records.


Command:
cqlsh> TRUNCATE  TABLE  cloudduggu.emp_name;


Output:
cassandra truncate command cloudduggu