Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: drop大的日志表,存储上面会很快释放空间吗?
[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version] v5.4.0 3tidb 3pd 3tikv
[Reproduction Path] What operations were performed when the issue occurred
[Encountered Issue: Issue Phenomenon and Impact]
[Resource Configuration] Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachments: Screenshots/Logs/Monitoring]
Planning to drop a large log table with approximately 200 million records. I would like to know the principle of the drop operation. After dropping, will the storage space be released quickly?
Excerpt from the official documentation:
In TiDB, using `DELETE`, `TRUNCATE`, and `DROP` statements to delete data will not immediately release space. For `TRUNCATE` and `DROP` operations, after reaching TiDB's GC (garbage collection) time (default 10 minutes), TiDB's GC mechanism will delete the data and release the space. For `DELETE` operations, TiDB's GC mechanism will delete the data but will not immediately release the space; instead, the space will be released during subsequent compaction.
It will not be released immediately; it will wait for the GC time and be cleaned up and released by the GC mechanism.
There will be no GC mechanism.
It depends on the GC time you set.
Executing the drop operation will not immediately release disk space.
Need to wait for GC to finish.
It will not be released immediately;
This is also a protection mechanism that allows time for regret and data recovery.
It won’t be cleaned up immediately, the advantage is that it can provide snapshot queries.
Generally, it won’t be immediate.
Drop releases very quickly, it is released as soon as the GC time arrives.
It definitely won’t be immediate; GC needs to be scheduled.
Does dropping the log table affect the cluster? I have a table with over ten terabytes that also needs to be dropped.
Space will definitely not be released immediately, as PD scheduling takes time.
The space is unlikely to be released immediately.
Need to wait for GC to finish.