undo_retention
Literally, the undo_retention parameter specifies the retention point of undo logs, which is the scope of the undo logs to be retained from the time dimension. After you set this parameter at the tenant level, OceanBase Database retains all multi-version data within the specified period. 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 TIMESTAMPMySQL 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 historical point in time specified by T - undo_retention to the current point in time specified by T.
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 a DDL operation is performed within the time range from T - undo_retention to T, the following rules apply:
If the DDL operation is to add columns, and you initiate a flashback query to query data generated before the operation, the system returns default values for all new columns.
If the DDL operation is to create a table, drop a table, or drop a column, and you initiate a flashback query to query data generated before the operation, the system reports an error.