This topic describes how to create, restore, modify, and delete MaxCompute table snapshots.
Introduction
A table snapshot preserves the data of a base table at a specific point in time.
Table snapshots can be configured with independent expiration times. The system automatically deletes a table snapshot when the specified time elapses after the snapshot is created.
Table snapshots are read-only. You can create (recover) tables from table snapshots to repair or restore table data.
Two major advantages of using table snapshots:
Longer data backup periods for data retention and restoration.
The maximum retention period of table snapshots exceeds the maximum retention period supported by the current local backup feature. You can retain data from a specified point in time as needed. If new business rules or data updates cause issues, you can restore data to a previous correct version based on table snapshots to avoid further impact on your business.
Minimized storage costs.
Only the bytes that differ between a snapshot and its base table are stored. Therefore, the storage space used by table snapshots is typically smaller than a complete copy of the table.
Applicability
Supported table types
Standard tables, including partitioned, non-partitioned, and clustered tables
Create a snapshot of a PK/Append Delta table
Unsupported table types
Transaction Table
View
Materialized views (Delta Live MV)
External Table
Region and tenant limits: A table snapshot must be in the same region and within the same tenant as its base table.
Table snapshots are read-only. You cannot directly update the data in a snapshot. To modify the data, you must create a standard table from the snapshot and then update the new table. You can, however, update a snapshot's metadata, such as its description, expiration date, and access permission policies.
Lifecycle limit: If you create a snapshot for a partitioned table that has a lifecycle configured, the lifecycle rule does not apply to the data in the snapshot.
Streaming write latency: Data that is written using Streaming Tunnel and flushed by calling
streamRecordPack.flushin the Tunnel software development kit (SDK) has a latency of 5 to 10 minutes before it can be included in a snapshot.Deleted table snapshots cannot be recovered.
Job limits
Maximum number of snapshots per table: 1,000.
Maximum number of concurrent CREATE SNAPSHOT jobs per project: 100.
Maximum total number of CREATE SNAPSHOT jobs per project per day: 50,000.
Maximum number of CREATE SNAPSHOT jobs per table per day: 50.
Create a table snapshot
Syntax
When creating a table, you can configure the data expiration time. Currently, if not set, the table snapshot will inherit the data time to live configured for the project (this will be changed in the future so that table snapshot expiration times are completely independent).
CREATE [OR REPLACE] SNAPSHOT TABLE [IF NOT EXISTS] <table_snapshot_name>
CLONE <source_table_name>
[OPTIONS(<snapshot_option_list>)]Parameters
Parameter | Description |
table_snapshot_name | The name of the table snapshot to create. |
source_table_name | The table on which to create the snapshot. |
snapshot_option_list |
|
Examples
CREATE SNAPSHOT TABLE <table_snapshot_name>
CLONE <source_table_name>
OPTIONS(
expiration_timestamp=TIMESTAMP "2025-07-01 00:00:00",
description="A table snapshot that expires in xxx days"
);Recover from a table snapshot
You can recover to the source table or create a new table.
CREATE [ OR REPLACE ] TABLE [ IF NOT EXISTS ] <source_table_name>
CLONE <table_snapshot_name>Modify a table snapshot
You can only modify OPTIONS.
ALTER SNAPSHOT TABLE [IF EXISTS] <snapshot_table_name>
SET OPTIONS(<snapshot_option_list>)Delete a table snapshot
DROP SNAPSHOT TABLE [IF EXISTS] <table_snapshot_name>Permissions
Table snapshot operations are similar to table operations. Permission management includes creating table snapshots, recovering from table snapshots, listing table snapshots, obtaining table snapshot descriptions, updating table snapshot metadata, deleting table snapshots, and querying data from table snapshots.
Billing
Storage fees apply to table snapshots. However, MaxCompute charges only for data in table snapshots that is not already included in any other table. The details are as follows:
When you create a table snapshot, no storage fees are incurred for the table snapshot.
If you add data to the base table after creating a table snapshot, no storage fees are incurred for the table snapshot due to this new data.
If you modify or delete data in the base table after creating a table snapshot, no storage fees are incurred for the updated or deleted data in the base table. However, because this data is still preserved in the snapshot table and will not be purged, storage fees will be incurred for the table snapshot.
NoteData that is modified or deleted in the base table can still be restored through local backup within the local backup period, and no local backup fees will be incurred.
If multiple table snapshots contain changed or deleted data, you are only charged for the storage consumed by the largest snapshot.