Updated on 2024-07-04 GMT+08:00

Setting the Retention Period for Multiversion Backup Data

Function

After multiversion is enabled, backup data is retained for seven days by default. You can change the retention period by setting system parameter dli.multi.version.retention.days. Multiversion data out of the retention period will be automatically deleted when the insert overwrite or truncate statement is executed. You can also set table attribute dli.multi.version.retention.days to adjust the retention period when adding a column or modifying a partitioned table.

For details about the syntax for enabling or disabling the multiversion function, see Enabling or Disabling Multiversion Backup.

Currently, the multiversion function supports only OBS tables created using the Hive syntax. For details about the syntax for creating a table, see Creating an OBS Table Using the Hive Syntax.

Syntax

1
2
ALTER TABLE [db_name.]table_name 
SET TBLPROPERTIES ("dli.multi.version.retention.days"="days");

Keywords

  • TBLPROPERTIES: This keyword is used to add a key/value property to a table.

Parameters

Table 1 Parameters

Parameter

Description

db_name

Database name, which consists of letters, digits, and underscores (_). The value cannot contain only digits or start with a digit or underscore (_).

table_name

Table name

days

Date when the multiversion backup data is reserved. The default value is 7 days. The value ranges from 1 to 7 days.

Precautions

Currently, the multiversion function supports only OBS tables created using the Hive syntax. For details about the syntax for creating a table, see Creating an OBS Table Using the Hive Syntax.

Example

Set the retention period of multiversion backup data to 5 days.
1
2
ALTER TABLE test_table 
SET TBLPROPERTIES ("dli.multi.version.retention.days"="5");