---
sidebar_position: 1
title: ALTER DATABASE
description: Update storage-related settings on a MotherDuck 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

```sql
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`](/sql-reference/motherduck-sql-reference/alter-database-snapshot) to restore a database to a snapshot.

Refer to the [snapshots guide](/concepts/snapshots) for snapshot behavior and to [Storage lifecycle](/concepts/storage-lifecycle#standard-databases) 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

```sql
ALTER DATABASE my_db SET snapshot_retention_days = 7;
```
