Delete Large Tables in TiDB

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

Original topic: tidb删除大表

| username: lxzkenney

TiDB version: 5.0.3
Are there any precautions to take when deleting several large tables around 1TB?

| username: Kongdom | Original post link

If it’s a full table deletion, truncate table is very fast.

| username: songxuecheng | Original post link

Pay attention to backups.

| username: WalterWj | Original post link

Calculate the GC time, preferably during off-peak hours.

| username: wuxiangdong | Original post link

Both drop and truncate can be used. Pay attention to whether the downstream is functioning properly and whether the space is being reclaimed.

| username: OnTheRoad | Original post link

If it is a delete, be sure to delete in batches. If it is a truncate or drop, you can delete directly.

| username: lxzkenney | Original post link

:call_me_hand::call_me_hand::call_me_hand:

| username: 近墨者zyl | Original post link

When deleting a large table, in addition to considering whether the GC period is a business peak, you also need to be aware that the deletion of a large table will suddenly create many empty regions. By monitoring PD in Grafana, you will see a significant increase in the empty-region-count in the Region health monitoring item. Empty regions can interfere with PD scheduling, so you need to manually merge empty regions at this time. Therefore, the operation of deleting a large table should be performed during off-peak business hours, and region merge should be done immediately after deletion.

| username: system | Original post link

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