This topic describes how to create, recover, modify, and delete MaxCompute table snapshots.
What is a table snapshot
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.
Limits
A table snapshot must be in the same region and under the same tenant as its base table.
Table snapshots are read-only. You cannot update data in a table snapshot unless you create a standard table from the snapshot and then update the data. You can only update the metadata of a table snapshot, such as its description, expiration date, and access permission policies.
Snapshot Table currently supports only standard tables, not Delta Tables.
You cannot obtain snapshots of views, materialized views (Delta Live MV), or foreign tables.
When you create a table snapshot, you cannot overwrite an existing table or table snapshot.
If you create a snapshot for a partitioned table with a configured lifecycle, the lifecycle information is not preserved in the snapshot.
Data written through Streaming Tunnel and immediately flushed by calling
streamRecordPack.flushthrough the Tunnel SDK requires 5-10 minutes before it can be included in a snapshot.Job limits:
Maximum number of concurrent table snapshot jobs per project: 100.
Maximum total number of table snapshot jobs per project per day: 50,000.
Maximum number of table snapshot jobs per table per day: 50.
Maximum number of snapshots per table: 1,000.
Table snapshots cannot be recovered after deletion.
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 modified or deleted data, you are charged only for the storage space used by the largest table snapshot.