ALTER DATABASE
The ALTER DATABASE statement updates storage-related settings for an existing MotherDuck database.
This statement applies to MotherDuck native storage databases (standard or transient). DuckLake databases do not support these options.
Syntax
ALTER DATABASE <database_name> SET SNAPSHOT_RETENTION_DAYS = <days>
Options
Currently, the only supported option is snapshot_retention_days.
| Name | Data Type | Description |
|---|---|---|
| SNAPSHOT_RETENTION_DAYS | INTEGER | Number of days to retain automatic and unnamed snapshots. Must be a non-negative integer and within your plan limits. 0 disables historical snapshots. Named snapshots are retained until unnamed. |
Notes
Use ALTER DATABASE SET SNAPSHOT to restore a database to a snapshot.
Refer to the snapshots guide for snapshot behavior and to Storage lifecycle for plan limits on retention.
Plan limits
For standard and transient databases, SNAPSHOT_RETENTION_DAYS is limited by plan:
- Business: 0-90 days
- Lite (paid): 1 day (min/max)
- Lite (free): 0 days (min/max)
Examples
ALTER DATABASE my_db SET snapshot_retention_days = 7;