If we truncate table will it create tombstone? also if we delete all the records of a partition key having thousands of records will create more tombstone?
If we truncate table will it create tombstone? also if we delete all the records of a partition key having thousands of records will create more tombstone?
Hi! Truncate will not create tombstones, it'll remove all of the data instead of marking the data as deleted. In regards to the partition level tombstones, if you delete by the partition key then it will mark the partition as deleted and remove all of the rows below the partition, so no, you will not have any tombstones except the one partition level tombstone, which is not an issue.
For example, here's our table definition:
CREATE TABLE cycling.route (race_id int, race_name text, point_id int, lat_long tuple<text, tuple<float,float>>, PRIMARY KEY (race_id, point_id));
The partition delete would look like the following where race_id is the partition key from above:
DELETE FROM cycling.calendar WHERE race_id = 200;
You would get 1 tombstone for the partition level delete, but that's it.
What you wouldn't want to do is go in and delete each row within the partition, that would create a lot of tombstones and that's what you want to avoid.
Partition level tombstones are fine, TTL's aren't as bad as normal tombstones either, but column and row level tombstones are what you want to stay away from.
7 People are following this question.
DataStax Enterprise is powered by the best distribution of Apache Cassandra ™
© 2023 DataStax, Titan, and TitanDB are registered trademarks of DataStax, Inc. and its subsidiaries in the United States and/or other countries.
Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries.
Privacy Policy Terms of Use