I would like to ask, if a table is deleted, will the disk space be immediately released? If not, how can the space be released?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 想问一下,如果把表删了,磁盘空间会立即释放吗?如果不会释放应该怎么才能把空间给释放出来

| username: TiDBer_RSav8Cg3

I would like to ask, if a table is deleted, will the disk space be immediately released? If not, how can the space be released?

| username: tidb菜鸟一只 | Original post link

No, you need to wait for GC. You can speed up the GC process by configuring these parameters:

| username: caiyfc | Original post link

It will not be released immediately.
Generally, it waits for GC, and the space will be released after GC is completed.

| username: TiDBer_RSav8Cg3 | Original post link

Are those .sst files in TiKV the data files of the table? After GC is completed, are these .sst files removed or how are they released?

| username: tidb菜鸟一只 | Original post link

Yes, the underlying layer of TiKV is RocksDB, and SST files are the data files of RocksDB.

| username: cassblanca | Original post link

The MVCC mechanism will not release immediately.

| username: zhanggame1 | Original post link

I observed that there aren’t many SST files in the db directory, and they aren’t very large. The folder that takes up the most space is the raft engine folder.

| username: zhouzeru | Original post link

When a table is deleted, the disk space is not immediately released because TiDB uses an MVCC (Multi-Version Concurrency Control) storage engine, and the deleted data may still be referenced by other transactions.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.