Release Storage After Table Truncate

what’s the best way to release the storage of sst files after a huge table is truncated?

Truncating a huge table writes tombstones over the existing data which will keep it around for 24 hours (the default GC period). We should probably do something different for table deletion / truncation. After the GC period expires, the data will be deleted and then the space will be reclaimed via the normal RocksDB compaction cycle. There are currently no knobs to accelerate that compaction process.

Thanks for the info. Is there a way to let the cockroach debug compact command to clean up the data after truncate? Would it be a useful feature?

Note that keeping the data around for a while is also a safeguard, you can restore the data using SELECT … AS OF SYSTEM TIME … to access the table “before it was deleted”.