# Set Tidb_Snapshot Parameter To Read Historical Data

+ Step 1: View historical data
  + `set @@tidb_snapshot="2020-10-08 16:45:26";` 
  + `Query OK, 0 rows affected (0.00 sec)` 
+ Step 2: Perform secondary processing of the retrieved target results and apply them to the target business table

------------------------------------------------------------
TiDB implements the ability to read historical data through the standard SQL interface, without the need for a special client or driver. A new system variable, tidb_snapshot, has been introduced, which has the scope of SESSION.

- View historical data
  - Modify the value of this variable by standard SET statement to the target time for data recover
    - The data type of this variable is text and can store TSO and date-times. TSO is the global timestamp obtained from the PD side. The format of the date and time is: “2016-10-08 16:45:26 .999”. Generally speaking, it can only be written to seconds, such as “2016-10-08 16:45:26”.
  - When the variable is set, TiDB will create a snapshot according to the set timestamp (no overhead, just create the data structure)
  - Read data from this snapshot using a SELECT statement.
  - After reading the historical version, you can end the current session or set the value of the tidb_snapshot variable to “” using the SET statement to read the latest version of the data.
- Secondary processing of the retrieved target results, such as generating reverse SQL, is applied to the target business table.
