All Products
Search
Document Center

MaxCompute:Lifecycle

Last Updated:Mar 03, 2026

The MaxCompute table lifecycle feature automatically reclaims table or partition data that remains unchanged for a specified period after its last update. This specified period is the lifecycle. Setting a lifecycle enables automatic data cleanup or retention, reducing storage costs.

Basic Definitions and Functions

  • Unit and Value: The lifecycle unit is day. The value must be a positive integer.

  • Function: Enables periodic automatic reclamation of tables or partitions.

Reclamation Rules

  • Start Time: Lifecycle calculation begins at the last data modification time (LastModifiedTime) of the table or partition.

  • Trigger Conditions:

    Reclamation occurs only when the LastModifiedTime exceeds the specified lifecycle duration. A table or partition is eligible for reclamation when (current time - LastModifiedTime) > lifecycle days.

  • Execution Mechanism:

    The system scans all tables and partitions daily at a scheduled time to identify candidates for reclamation. Actual reclamation timing depends on service load. Immediate execution after expiration is not guaranteed. After the data's time to live reaches the deletion point, data is deleted within 24 hours.

  • Example:

    Assume a partitioned table has a lifecycle of 1 day and the last modification time for data in a partition is February 17, 2026, 15:00. If the table is scanned before February 18, 2026, 15:00, the partition will not be reclaimed. If a scan on February 19, 2026, finds that the partition's LastModifiedTime exceeds the specified lifecycle duration, the partition will be reclaimed.

Applicable Rules for Different Table Types

  • Non-partitioned Tables

    • The lifecycle applies to the entire table.

    • You can specify the lifecycle when you create the table. If you do not specify a lifecycle, MaxCompute does not automatically reclaim the table or its partitions based on lifecycle rules.

    • If table data is not modified within its lifecycle, MaxCompute automatically reclaims the entire table after the specified number of days, similar to a DROP TABLE operation.

    • After deleting a table, all its property information—including the lifecycle—is deleted. When you create a new table with the same name, the table's lifecycle follows the newly set properties.

  • Partitioned Tables

    • The lifecycle applies to each individual partition. However, you can only set the lifecycle at the table level. You cannot set the lifecycle at the partition level. The lifecycle specified for a partitioned table applies to all its partitions.

    • You can specify the lifecycle when you create the table. If you do not specify a lifecycle, MaxCompute does not automatically reclaim partitions based on lifecycle rules.

    • Partitions not modified within their lifecycle are reclaimed individually.

    • Unlike non-partitioned tables, the table is not deleted after its last partition is reclaimed.

    • After deleting a table, all its property information—including the lifecycle—is deleted. When you create a new table with the same name, the table's lifecycle follows the newly set properties.

Auditing and Monitoring

  • Executor:

    The Alibaba Cloud service account maxcompute.aliyuncs.com performs lifecycle data reclamation operations.

  • Operation Records:

    You can retrieve relevant operation records from the ActionTrail service. For more information, see Event Query Quick Start. For example, you might see records such as 'Table bettergithubanalytics.test_lifecycle automatically reclaimed by MaxCompute based on its lifecycle'.

    Automatic Reclamation of Non-partitioned Tables

    Table bettergithubanalytics.test_lifecycle is automatically reclaimed by MaxCompute based on its lifecycle. You can see the following records.删除表基本信息事件详情

    Automatic Reclamation of Partitioned Table Partitions

    Partition bettergithubanalytics.sale_detail of table sale_date=2013/region=china is automatically reclaimed by MaxCompute based on its lifecycle. You can see the following records.删除分区删除分区事件详情

References

  • For operations such as specifying and modifying table lifecycles, and modifying table LastModifiedTime when creating tables, see Table Operations.

  • For more lifecycle operations, such as setting, disabling, or recovering lifecycles for existing or new tables, see Lifecycle Operations.

  • You can also view reclamation operation records for table partitions using the Data Map feature in DataWorks. For more information, see Data Map Overview. The displayed operator account is the MaxCompute system account odps_user@aliyun.com, which is the Alibaba Cloud service named maxcompute.aliyuncs.com.数据地图查看