SHOW SNAPSHOTS IN SNAPSHOT SET¶
Lists all the snapshots in a snapshot set.
Syntax¶
SHOW SNAPSHOTS IN SNAPSHOT SET <name>
Parameters¶
name
Specifies the identifier for the snapshot set.
If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.
For more information, see Identifier requirements.
Access control requirements¶
A role used to execute this operation must have the following privileges at a minimum:
Privilege |
Notes |
---|---|
OWNERSHIP |
You must have the OWNERSHIP privilege on the snapshot set to see the snapshots that it contains. |
For instructions on creating a custom role with a specified set of privileges, see Creating custom roles.
For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.
Usage notes¶
The command returns a maximum of ten thousand records for the specified object type, as dictated by the access privileges for the role used to execute the command. Any records above the ten thousand records limit aren’t returned, even with a filter applied.
To view results for which more than ten thousand records exist, query the corresponding view (if one exists) in the Snowflake Information Schema.
Output¶
Column |
Description |
---|---|
|
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. |
Examples¶
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;