SHOW SNAPSHOTS IN SNAPSHOT SET¶
Lists all the snapshots in a snapshot set.
语法¶
SHOW SNAPSHOTS IN SNAPSHOT SET <name>
参数¶
nameSpecifies the identifier for the snapshot set.
如果标识符包含空格或特殊字符,则整个字符串必须放在双引号内。放在双引号内的标识符也区分大小写。
有关更多信息,请参阅 标识符要求。
访问控制要求¶
权限 |
备注 |
|---|---|
OWNERSHIP |
You must have the OWNERSHIP privilege on the snapshot set to see the snapshots that it contains. |
有关创建具有指定权限集的自定义角色的说明,请参阅 创建自定义角色。
使用说明¶
该命令 最多 返回指定对象类型的 1 万条记录,由用于执行命令的角色的访问权限决定。即使应用了筛选器,也不会返回任何超出 1 万条限制后的记录。
要查看存在超过 1 万条记录的结果,请在 Snowflake Information Schema 中查询相应的视图(如果存在)。
输出¶
列 |
描述 |
|---|---|
|
Timestamp snapshot is created. |
|
Snowflake-generated identifier of the snapshot. The snapshot ID is a UUID value, in the format returned by the UUID_STRING function. |
|
Name of snapshot set that contains the snapshot. |
|
Name of database that contains the snapshot set. |
|
Name of schema that contains the snapshot set. |
|
Timestamp when the snapshot expires. |
示例¶
List all snapshots in snapshot set t1_snapshots:
SHOW SNAPSHOTS IN SNAPSHOT SET t1_snapshots;
Show the creation date and snapshot ID for the oldest snapshot in snapshot set t1_snapshots:
SHOW SNAPSHOTS IN SNAPSHOT SET t1_snapshots ->>
SELECT "created_on", "snapshot_id" FROM $1
ORDER BY "created_on" LIMIT 1;
Show the snapshot ID and the date and time when the final snapshot in snapshot set t1_snapshots will expire.
This example presumes that the snapshot policy doesn't include a schedule, or the snapshot policy is suspended
for the snapshot set, so that no new snapshots are being added to the snapshot set. You're just waiting for
all the existing snapshots to expire so that you can drop the snapshot set.
SHOW SNAPSHOTS IN SNAPSHOT SET t1_snapshots ->>
SELECT "expire_on", "snapshot_id" FROM $1
ORDER BY "expire_on" DESC LIMIT 1;