# Flashback Operation

__*FLASHBACK TABLE*__

+ `FLASHBACK TABLE`: Restore discarded tables and data within the garbage collection lifecycle window

```8
tidb> select count(*), now() from test.r1;
+----------+---------------------+
| count(*) | now()               |
+----------+---------------------+
|        2 | ~!@2022-01-07 14:24:25@!~ |
+----------+---------------------+

tidb> ~!@drop table@!~ test.r1;

tidb> SELECT * FROM mysql.tidb WHERE variable_name = '~!@tikv_gc_safe_point@!~';
+--------------------+-------------------------+--------------------------------------------------------------+
| VARIABLE_NAME      | VARIABLE_VALUE          | COMMENT                                                      |
+--------------------+-------------------------+--------------------------------------------------------------+
| tikv_gc_safe_point | ~!@20220107-14:11:37 +0000@!~ | All versions after safe point can be accessed. (DO NOT EDIT) |
+--------------------+-------------------------+--------------------------------------------------------------+

tidb> ~!@flashback table@!~ test.r1 to r2;

tidb> select count(*) from test.r2;
+----------+
| count(*) |
+----------+
|        2 |
+----------+
```
------------------------------------------------------------

Statement 1: You drop table test.r1 around 14:24.

Statement 2: You found that the GC safe point is around 14:11, so any data that existed in the last 13 minutes is still kept by MVCC, you can bring it back by FLASHBACK TABLE.

Statement 3: The FLASHBACK TABLE in action.

Statement 4: The data is recovered to test.r2.


