> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreweave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage database

> Edit, resize, scale, maintain, restart, and delete a CoreWeave Database after creation

After you create your database, you can modify most configuration properties to ensure your database remains right-sized as your workload's demands change. This page covers each lifecycle action through both the Cloud Console and `kubectl`.

For configurable fields and their constraints, see [Configure database](https://docs.coreweave.com/products/storage/cwdb/configure.md). For backup-driven database replacement (the only way to change immutable fields like name or initial database name), see [Manage backups](https://docs.coreweave.com/products/storage/cwdb/backups.md).

Each row in the **Databases** list has a three-dot menu with the following actions:

* **View details** opens the database details panel on the **Details** tab.
* **Resize / scale** opens the **Edit database** form. See [Edit a database](#edit-a-database).
* **Manage backups** opens the database details panel on the **Backups** tab. See [Manage backups](https://docs.coreweave.com/products/storage/cwdb/backups.md#view-backups-from-the-cloud-console).
* **Delete** opens a confirmation dialog. See [Delete a database](#delete-a-database).

## Edit a database

You can edit a database after creation. The database name, namespace, initial database name, database engine, and compute cluster can't change.

Replica scale-out (increasing or decreasing `spec.postgres.instances`) is supported. To change per-instance CPU or memory, restore the database into a new one with the desired sizing. See [Manage backups](https://docs.coreweave.com/products/storage/cwdb/backups.md).

### Edit from the Cloud Console

To edit a database from the Cloud Console, follow these steps:

1. In the Cloud Console, open **Infrastructure > Data and storage** and select the **Databases** tab.
2. Click the database row to open the details view, then click **Edit configuration**. The row's three-dot menu **Resize / scale** action opens the same form.
3. The **Edit database** form opens with a YAML preview pane on the right. Immutable fields are shown but disabled.
4. Update the form fields, or edit the YAML pane directly. Changes in either pane sync to the other.
5. Click **Submit** to apply.

The database is updated with the new configuration.

### Edit with kubectl

Open the resource in your default editor. Replace `[CLUSTER-NAME]` with the name of your `CWDBCluster` and `[NAMESPACE]` with the namespace it runs in:

```bash theme={"system"}
kubectl edit cwdbcluster [CLUSTER-NAME] --namespace [NAMESPACE]
```

Alternatively, apply an updated manifest:

```bash theme={"system"}
kubectl apply -f cwdb_cluster.yaml --namespace [NAMESPACE]
```

The operator rejects changes to immutable fields.

## Resize a database

You can increase per-instance storage size after creation. See [Storage](https://docs.coreweave.com/products/storage/cwdb/configure.md#storage) and [Compute](https://docs.coreweave.com/products/storage/cwdb/configure.md#compute).

Resize uses the Edit form internally. For changes to fields other than storage size, see [Edit a database](#edit-a-database).

### Resize from the Cloud Console

To resize a database from the Cloud Console, follow these steps:

1. In the **Databases** list, open the database row's three-dot menu and select **Resize / scale**. The **Edit database** form opens.
2. In the **Resources** section, increase **Storage size (GiB)**.
3. Click **Submit**.

The new storage size is applied to each instance's Distributed File Storage (DFS) volume.

### Resize with kubectl

Increase `spec.storage.resources.requests.storage` on the database:

```bash theme={"system"}
kubectl edit cwdbcluster [CLUSTER-NAME] --namespace [NAMESPACE]
```

The new size is applied to each instance's DFS volume.

## Schedule maintenance

CoreWeave performs maintenance operations on your database, such as PostgreSQL minor version upgrades. CoreWeave runs a major version upgrade only when you request one through your customer Slack channel. To control when maintenance runs, use `spec.maintenance`. To check for pending maintenance, read `status.maintenance` as described in [Database status](https://docs.coreweave.com/products/storage/cwdb/configure.md#database-status).

During a minor version upgrade, CoreWeave Database restarts the replicas one at a time with the new version. It then restarts the primary in place, which interrupts writes until the primary is back. A major version upgrade shuts down all instances while PostgreSQL is upgraded, so the database is unavailable until the upgrade finishes.

To set the fields in this section, edit the `CWDBCluster` as described in [Edit with kubectl](#edit-with-kubectl).

### Set a maintenance window

A maintenance window is a recurring period in which maintenance can start. Set it in `spec.maintenance.window`:

```yaml highlight={3-7} theme={"system"}
spec:
  maintenance:
    window:
      days: Mon-Fri
      startTime: "23:00"
      timeZone: UTC
      duration: 1h
```

| Field | Description | Default |
| - | - | - |
| `days` | Days of the week in the window. Use short or long day names, with commas between days and hyphens for ranges, such as `Mon-Fri` or `Sun,Wed-Fri`. | `Mon-Thu` |
| `startTime` | Start time of each window, in `HH:MM` or `HH` format. | `23:00` |
| `timeZone` | Internet Assigned Numbers Authority (IANA) time zone for `startTime`, such as `America/New_York`. | `UTC` |
| `duration` | Length of each window, from `30m` to `24h`. | `1h` |

Pending maintenance starts in the first window after `status.maintenance.startingAfter`.

### Schedule maintenance for a specific time

To run pending maintenance at a specific time, set `spec.maintenance.scheduleFor` to a [Request for Comments (RFC) 3339](https://www.rfc-editor.org/rfc/rfc3339) timestamp. `scheduleFor` overrides the maintenance window.

```yaml highlight={3} theme={"system"}
spec:
  maintenance:
    scheduleFor: "2026-12-01T02:00:00Z"
```

`scheduleFor` can't be later than `status.maintenance.cutoffTime`, the latest time the maintenance can be deferred to. After maintenance starts, changing `scheduleFor` has no effect.

Urgent maintenance can run outside your maintenance window and `scheduleFor`. See the [Maintenance Policy](https://docs.coreweave.com/policies/terms-of-service/maintenance-policy.md).

## Restart a database

To request a rolling restart of the database instances, change `spec.postgres.restartAt` to a new RFC 3339 timestamp. The following command sets it to the current time:

```bash theme={"system"}
kubectl patch cwdbcluster [CLUSTER-NAME] --namespace [NAMESPACE] --type merge \
  --patch "{\"spec\":{\"postgres\":{\"restartAt\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}}}"
```

The restart starts when you apply the change. It doesn't wait for the maintenance window.

> [!NOTE]
>
> A rolling restart restarts the primary instance in place, which interrupts writes until the primary is back. Configuration changes that restart database Pods have the same effect. Schedule restarts and these changes for a period of low write traffic.

## Delete a database

When you delete a database, Kubernetes removes the database `Pods`, the pooler `Services`, the credentials `Secrets`, and the PersistentVolumeClaims (PVCs) for the per-instance DFS volumes. Deleting a PVC doesn't immediately delete the DFS volume behind it, so retained storage can outlive the database. On CKS, the DFS StorageClass retains a volume after its PVC is deleted, and the Persistent Volume Management Operator (PVMO) removes it after a soft-delete window, 24 hours by default. See [Volume deletion and data recovery](https://docs.coreweave.com/products/storage/distributed-file-storage/about.md#volume-deletion-and-data-recovery).

Treat deletion as irreversible for the live database. Deleting a `CWDBCluster` doesn't delete its backups. Scheduled base backups still expire 7 days after each was taken, and on-demand backups remain until their `CWDBBackup` resources are deleted. Deleting the namespace deletes those resources and their backup copies. To restore a deleted database, see [Restore after deleting the source database](https://docs.coreweave.com/products/storage/cwdb/backups.md#restore-after-deleting-the-source-database).

> [!WARNING]
>
> Don't rely on retained volumes to recover a deleted database. Restores always create a new database. If you may need the data later, take an on-demand backup before deleting. See [Manage backups](https://docs.coreweave.com/products/storage/cwdb/backups.md).

### Delete from the Cloud Console

The Cloud Console provides two ways to delete a database:

* In the **Databases** list, open the database row's three-dot menu and select **Delete**.
* In the database's details view, scroll to **Danger zone** and click **Delete database**.

Both open a confirmation dialog before deletion.

### Delete with kubectl

To delete the database, remove the `cwdbcluster` resource:

```bash theme={"system"}
kubectl delete cwdbcluster [CLUSTER-NAME] --namespace [NAMESPACE]
```

Kubernetes removes the database `Pods`, the pooler `Services`, the credentials `Secrets`, and the PVCs for the per-instance DFS volumes. The underlying DFS volumes are retained and then removed as described in [Delete a database](#delete-a-database).
