Updated on 2026-06-27 GMT+08:00

set_current_snapshot

Basic Syntax

You can use set_current_snapshot to set the current snapshot ID of a table. Unlike rollback, the snapshot is not required to be an ancestor of the current table state. For example:

Set the current snapshot for table db.sample to the snapshot whose ID is 1.

CALL prod.system.set_current_snapshot('db.sample', 1);

Set the current snapshot for table db.sample to the snapshot whose tag is s1.

CALL prod.system.set_current_snapshot(table => 'db.sample', ref => 's1');

The table name field is of the string type, the snapshot ID field is of the long type, and ref is the snapshot reference (branch or tag) of the current snapshot, which is of the string type. Either snapshot_id or ref must be provided but not both.

Table 1 describes the output results.

Table 1 Snapshot setting output

Parameter

Type

Description

previous_snapshot_id

long

The current snapshot ID before the rollback

current_snapshot_id

long

The new current snapshot ID