# Settings-profile statements (/docs/reference/sql/statements/settings-profile)



Settings-profile statements [#settings-profile-statements]

This page describes statements accepted by the Query API in RawTree Cloud
and RawTree BYOC. Its restrictions apply to the API, not to all RawTree SQL.
See [ClickHouse compatibility and API scope](/docs/reference/clickhouse-compatibility).

Syntax [#syntax]

```sql
CREATE SETTINGS PROFILE [OR REPLACE | IF NOT EXISTS] <name>
  [ON CLUSTER 'default']
  SETTINGS workload = '<name>' [READONLY | CONST]
    [, use_concurrency_control = 0|1 [READONLY | CONST]]
  TO <existing role>, ...
DROP SETTINGS PROFILE [IF EXISTS] <name> [ON CLUSTER 'default']
```

Clauses [#clauses]

| Clause                                                                                    | Meaning                                       |
| ----------------------------------------------------------------------------------------- | --------------------------------------------- |
| [`workload`](/docs/reference/sql/settings/session#workload)                               | Set a role's default workload.                |
| [`use_concurrency_control`](/docs/reference/sql/settings/session#use_concurrency_control) | Enable or disable concurrency control.        |
| `READONLY`                                                                                | Apply the profile's setting as read-only.     |
| `CONST`                                                                                   | Prevent the role from overriding the setting. |
| `TO`                                                                                      | Attach the profile to existing roles.         |

<a id="rawtree-behavior" />

Query API behavior [#query-api-behavior]

* **Supported:** [`workload`](/docs/reference/sql/settings/session#workload) and
  [`use_concurrency_control`](/docs/reference/sql/settings/session#use_concurrency_control),
  with `READONLY` or `CONST`, for existing roles. Access storage controls
  profile replication.
* **Not exposed by the Query API:** `ALTER SETTINGS PROFILE`, other profile settings,
  inheritance, user targets, and clusters other than `default`.
* **Query API scope:** This API supports one profile statement
  per request and only its two scheduling settings.

Errors [#errors]

Error: `Unsupported settings profile statement.`

Hint:

```text
Use CREATE SETTINGS PROFILE [OR REPLACE | IF NOT EXISTS] <name> SETTINGS workload = '<name>' and/or use_concurrency_control = 0/1, optionally READONLY or CONST, TO <existing roles>; or DROP SETTINGS PROFILE [IF EXISTS] <name>. Only ON CLUSTER 'default' is supported. Submit one statement.
```

Examples [#examples]

Create a role for the profile.

```sql test
CREATE ROLE profile_statement_analyst
```

Create the workload that the profile assigns.

```sql test
CREATE WORKLOAD profile_statement_workload ON CLUSTER 'default'
```

Assign the workload and prevent overrides.

```sql test
CREATE SETTINGS PROFILE profile_statement_profile SETTINGS workload = 'profile_statement_workload' CONST TO profile_statement_analyst
```

Drop the profile before the role.

```sql
DROP SETTINGS PROFILE IF EXISTS profile_statement_profile
```

```sql
DROP ROLE IF EXISTS profile_statement_analyst
```

Drop the workload after the profile.

```sql
DROP WORKLOAD IF EXISTS profile_statement_workload ON CLUSTER 'default'
```

The parser rejects `ALTER SETTINGS PROFILE`.

```sql test expect-error="Unsupported ALTER statement."
ALTER SETTINGS PROFILE profile_statement_profile SETTINGS workload = 'default'
```

The parser rejects settings other than the supported scheduling settings.

```sql test expect-error="Unsupported settings profile statement."
CREATE SETTINGS PROFILE restricted_profile SETTINGS max_memory_usage = 1 TO profile_statement_analyst
```

The parser rejects profile inheritance.

```sql test expect-error="Unsupported settings profile statement."
CREATE SETTINGS PROFILE restricted_profile IN profile_statement_profile SETTINGS workload = 'default' TO profile_statement_analyst
```

The parser rejects user targets.

```sql test expect-error="Unsupported settings profile statement."
CREATE SETTINGS PROFILE restricted_profile SETTINGS workload = 'default' TO USER analytics_user
```

The parser rejects other clusters.

```sql test expect-error="Unsupported settings profile statement."
CREATE SETTINGS PROFILE restricted_profile ON CLUSTER 'other' SETTINGS workload = 'default' TO profile_statement_analyst
```

Related [#related]

* [Workload scheduling](/docs/concepts/workload-scheduling)
* [Lock a role to a workload](/docs/guides/operate/settings-profiles)
