UNDO_RETENTION
The undo_retention parameter specifies the retention point of undo logs. The retention point indicates the scope of the logs to be retained from the time dimension. After you set this parameter at the tenant level, OceanBase Database retains different versions of the undo logs within the scope. The default unit of undo_retention is seconds.
Flashback query
A flashback query allows you to query the data of a historical version. OceanBase Database supports the following syntax for flashback queries:
Oracle mode:
AS OF SCNandAS OF TIMESTAMP.MySQL mode:
AS OF SNAPSHOT.
After you set the undo_retention parameter at the tenant level, you can initiate a flashback query to query specific versions within the time range from the current point in time specified by T to the historical point in time specified by T - undo_retention. If a restore point is retained, you can query the version corresponding to the restore point. In addition, OceanBase Database allows you to query data at the point in time when a major compaction is performed on a cluster.
Query replica selection
Flashback queries differ from general queries. For a query for data of a historical version, the SQL layer does not always query the leader. Instead, the SQL layer queries the replica on the local server first. If the data does not exist in the local replica, the SQL layer queries replicas on other servers in the same zone, and then queries the leader.
Considerations
If DDL operations are performed within the time range from T to T - undo_retention, OceanBase Database parses table data by using the latest data dictionary. For the data generated before the DDL operations, the data whose column is deleted is marked as Deleted, and the data in newly created columns is set to default values.