How to determine whether the space of a deleted table has been reclaimed or not?

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

Original topic: 一个表被删除了,怎么确定这个表的空间被回收了还是没被回收呢?

| username: 数据源的TiDB学习之路

[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version] 7.1
[Reproduction Path] Performing a drop operation on a large table, but the space is not immediately reclaimed after the drop. Instead, it waits for GC to actually reclaim it. So, how can we confirm in TiDB whether the space of this table has really been reclaimed or not? The information_schema.TIKV_REGION_STATUS view should be inaccurate, right?
[Encountered Problem: Problem Phenomenon and Impact]
[Resource Configuration]
[Attachments: Screenshots / Logs / Monitoring]

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

SELECT * FROM mysql.gc_delete_range;
Check if the corresponding region is still in this table. If it is no longer there, it means it has already been GC’d.

| username: zhanggame1 | Original post link

The information_schema.TIKV_REGION_STATUS is accurate, you can just refer to this.

Dropping will not cause the region of this table to disappear; it will only disappear after being garbage collected (GC) later.
Deleting requires both GC and compaction to disappear.

| username: Soysauce520 | Original post link

Based on the time, check the monitoring. After dropping a large table and performing garbage collection, there should be empty regions. PD monitoring has region types.

| username: TiDBer_aKu9dgpb | Original post link

In the system table, there is corresponding information in information_schema.TIKV_REGION_STATUS, check it out.

You can find out.

| username: xiaoqiao | Original post link


| username: 哈喽沃德 | Original post link


| username: zhang_2023 | Original post link

SELECT * FROM mysql.gc_delete_range ;

| username: zhaokede | Original post link

Look at gc_delete_range

| username: 小于同学 | Original post link

information_schema.TIKV_REGION_STATUS is accurate, just refer to this.

| username: TiDBer_QYr0vohO | Original post link

select * from mysql.gc_delete_range ;

| username: TiDBer_21wZg5fm | Original post link

The table data is stored in the regions within TiKV. You can check whether the regions corresponding to the table exist to determine if it has been reclaimed.

| username: dba远航 | Original post link

Check if there are any corresponding regions in this table. If there are none, it means they have already been garbage collected, i.e., physically removed.