# RECOVER TABLE

+ Recover the most recently droped table
```
RECOVER TABLE t;
```

-----------------------------------------------------------------

When deleting a table, TiDB only deletes the table metadata, and writes the table data (row data and index data) to be deleted to the `mysql.gc_delete_range` table. The GC Worker in the TiDB background periodically removes from the `mysql.gc_delete_range` table the keys that exceed the `GC` life time.

Therefore, to recover a table, you only need to recover the table metadata and delete the corresponding row record in the mysql.`gc_delete_range` table before the `GC` Worker deletes the table data. You can use a snapshot read of TiDB to recover the table metadata. Refer to read historical data for details.

Table recovery is done by TiDB obtaining the table metadata through snapshot read, and then going through the process of table creation similar to `CREATE TABLE`. Therefore, `RECOVER TABLE` itself is, in essence, a kind of DDL operation.

If a table is deleted and the `GC` lifetime is out, the table cannot be recovered with `RECOVER TABLE`. Execution of `RECOVER TABLE` in this scenario returns an error like: `snapshot is older than GC safe point 2024-05-20 16:20:50 +0800 CST.`
