Iggydv
Iggydv

Reputation: 186

What are the best practices when performing a Truncate in Cassandra?

I want to perform a TRUNCATE on multiple tables with around 25 million records, in clustered, multi-data-center environment. I would just like some advice on steps to take before/after the truncate to ensure that there aren't huge discrepancies between the nodes.

According to this, a TRUNCATE deletes the SSTable holding the data. Does this mean that I'll need to set my consistency level to ALL before the truncate? Is a nodetool repair necessary after the operation?

Any advice would be greatly appreciated.

cqlsh 5.0.1 | Cassandra 3.11.2 | CQL spec 3.4.4

Upvotes: 1

Views: 2796

Answers (1)

JayK
JayK

Reputation: 800

Ensure that all nodes are up before issuing this command.

Truncate will naturally propogate out over the cluster as long as all nodes remain up and available.

Truncate will automatically run as if CONSISTENCY is set to ALL which ensures that the command only returns after all nodes have deleted their data and fail if a node cannot be reached.

Repair is not necessary as there will not be any data to repair after the operation.

Upvotes: 3

Related Questions