Table snapshots

更新时间:
复制 MD 格式

Table snapshots capture the data of a base table at a specific point in time. Use snapshots to:

  • Restore table data to a previous correct version after accidental deletion, incorrect updates, or problematic business rule changes.

  • Retain data from a specific point in time beyond the retention period supported by local backup.

  • Reduce storage costs — only the bytes that differ between a snapshot and its base table are stored.

How it works

A table snapshot is read-only. To modify the data in a snapshot, restore it to a new or existing table, then update that table. You can update a snapshot's metadata (description, expiration time, and access permissions) directly without restoring.

When you create a snapshot, no storage fees are incurred. Storage fees apply only to data preserved exclusively in the snapshot — data that has been modified or deleted in the base table after the snapshot was taken. If multiple snapshots contain the same changed or deleted data, you are charged for the storage consumed by the largest snapshot only.

Limitations

Supported table types:

Table typeSupported
Standard tables (partitioned, non-partitioned, and clustered)Yes
PK/Append Delta tableYes
Transaction TableNo
ViewNo
Materialized views (Delta Live MV)No
External TableNo

Constraints and quotas:

ConstraintLimit
Region and tenantA snapshot must be in the same region and within the same tenant as its base table.
Lifecycle rulesIf the base table has a lifecycle configured, the lifecycle rule does not apply to data in the snapshot.
Streaming write latencyData written using Streaming Tunnel and flushed via streamRecordPack.flush in the Tunnel software development kit (SDK) has a latency of 5 to 10 minutes before it can be included in a snapshot.
Snapshots per table1,000
Concurrent CREATE SNAPSHOT jobs per project100
CREATE SNAPSHOT jobs per project per day50,000
CREATE SNAPSHOT jobs per table per day50
Important

Deleted table snapshots cannot be recovered.

Create a table snapshot

CREATE [OR REPLACE] SNAPSHOT TABLE [IF NOT EXISTS] <table_snapshot_name>
CLONE <source_table_name>
[OPTIONS(<snapshot_option_list>)]

Parameters:

ParameterDescription
table_snapshot_nameThe name of the snapshot to create.
source_table_nameThe base table to snapshot.
expiration_timestampThe expiration time of the snapshot. Data type: TIMESTAMP. Must be later than the current time. If not set, the snapshot inherits the data time to live configured for the project. Note: this behavior will be changed in the future so that table snapshot expiration times are completely independent.
descriptionA description of the snapshot. Data type: STRING.

Example:

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"
);

Restore from a snapshot

Restore a snapshot to the original base table or to a new table:

CREATE [OR REPLACE] TABLE [IF NOT EXISTS] <target_table_name>
CLONE <table_snapshot_name>

Modify a snapshot

Only OPTIONS can be modified (description, expiration time, and access permissions):

ALTER SNAPSHOT TABLE [IF EXISTS] <snapshot_table_name>
SET OPTIONS(<snapshot_option_list>)

Delete a snapshot

DROP SNAPSHOT TABLE [IF EXISTS] <table_snapshot_name>
Important

Deleted snapshots cannot be recovered.

Permissions

Table snapshot operations follow the same permission model as table operations. Permissions cover:

  • Creating snapshots

  • Restoring from snapshots

  • Listing snapshots

  • Viewing snapshot descriptions

  • Updating snapshot metadata

  • Deleting snapshots

  • Querying data from snapshots

Billing

Storage fees apply only to data in a snapshot that is not already present in any other table. MaxCompute charges for the bytes that differ — not for a full copy of the table.

ScenarioStorage fee incurred?
Creating a snapshotNo
Adding data to the base table after the snapshotNo (new data is in the base table, not the snapshot)
Modifying or deleting data in the base table after the snapshotYes (the original data is preserved only in the snapshot)
Multiple snapshots containing the same changed or deleted dataCharged for the largest snapshot only
Note

Data modified or deleted in the base table can still be restored through local backup within the local backup retention period, with no additional local backup fees.