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

# ALTER RESOURCE GROUP

The `ALTER RESOURCE GROUP` [statement](https://docs.cockroachlabs.com/docs/stable/sql-statements.md) changes the options of a [resource group](https://docs.cockroachlabs.com/docs/stable/resource-groups.md).

> [!NOTE]
>
> **This feature is in [preview](https://docs.cockroachlabs.com/docs/releases/cockroachdb-feature-availability.md)** and subject to change. To share feedback and/or issues, contact [Support](https://support.cockroachlabs.com).

To use `ALTER RESOURCE GROUP`, you must first [enable resource groups](https://docs.cockroachlabs.com/docs/stable/resource-groups.md#enable-resource-groups).

## Required privileges

Only members of the [`admin` role](https://docs.cockroachlabs.com/docs/stable/security-reference/authorization#admin-role) can alter resource groups.

## Synopsis

![alter\_resource\_group syntax diagram](https://mintcdn.com/cockroachlabs/iBfszXHb4tKmDGVE/images/sql-diagrams/v26.4/alter_resource_group.svg?fit=max\&auto=format\&n=iBfszXHb4tKmDGVE\&q=85\&s=225d72ebc99414896f53afe15a9a7f57)

## Parameters

| Parameter | Description |
| - | - |
| `IF EXISTS` | Alter the resource group only if it exists. If it does not exist, the statement does nothing and does not return an error. |
| `name` | The name of the resource group to alter. |
| `with_resource_group_options` | The resource group options to change, written as `WITH (option = value, ...)`. Options that you do not specify keep their current values. For the supported options, refer to [Options](#options). |

### Options

| Option | Value | Description |
| - | - | - |
| `cpu_weight` | Positive integer | The group's CPU weight. A group's share of CPU is its weight divided by the sum of the weights of all user-defined resource groups. For details, refer to [How CPU is shared](https://docs.cockroachlabs.com/docs/stable/resource-groups.md#how-cpu-is-shared). |
| `max_cpu` | `BOOL` | Whether the group stays in the burst tier when it uses more than its share of CPU. For details, refer to [`max_cpu`](https://docs.cockroachlabs.com/docs/stable/resource-groups#max_cpu). |

## Considerations

* A change applies to sessions that are already assigned to the resource group.
* Changing one group's `cpu_weight` changes the CPU share of every user-defined resource group, because each share is calculated from the sum of all weights.

## Examples

The examples on this page use the following resource groups:

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
CREATE RESOURCE GROUP oltp WITH (cpu_weight = 300, max_cpu = true);
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
CREATE RESOURCE GROUP reporting WITH (cpu_weight = 100);
```

### Change the CPU weight of a resource group

The following statement increases the CPU weight of the `reporting` group:

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
ALTER RESOURCE GROUP reporting WITH (cpu_weight = 200);
```

View the new CPU shares with [`SHOW RESOURCE GROUPS`](https://docs.cockroachlabs.com/docs/stable/show-resource-groups). The share of `oltp` also changes, because the sum of the weights changed:

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SHOW RESOURCE GROUPS;
```

```
  id |   name    | cpu_weight | max_cpu | cpu_share_percent
-----+-----------+------------+---------+--------------------
  17 | oltp      |        300 |    t    |                60
  18 | reporting |        200 |    f    |                40
(2 rows)
```

### Change the `max_cpu` option of a resource group

The following statement sets `max_cpu` for the `reporting` group, so that the group stays in the burst tier when it uses more than its share. The group's `cpu_weight` does not change:

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
ALTER RESOURCE GROUP reporting WITH (max_cpu = true);
```

View the group with `SHOW RESOURCE GROUP`:

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SHOW RESOURCE GROUP reporting;
```

```
  id |   name    | cpu_weight | max_cpu | cpu_share_percent
-----+-----------+------------+---------+--------------------
  18 | reporting |        200 |    t    |                40
(1 row)
```

## See also

* [Resource Groups](https://docs.cockroachlabs.com/docs/stable/resource-groups.md)
* [`CREATE RESOURCE GROUP`](https://docs.cockroachlabs.com/docs/stable/create-resource-group)
* [`DROP RESOURCE GROUP`](https://docs.cockroachlabs.com/docs/stable/drop-resource-group)
* [`SHOW RESOURCE GROUPS`](https://docs.cockroachlabs.com/docs/stable/show-resource-groups)
* [SQL Statements](https://docs.cockroachlabs.com/docs/stable/sql-statements.md)
