ReferenceSQL ReferenceStatements

Settings-profile statements

Assign workload and concurrency settings to database roles.

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.

Syntax

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

ClauseMeaning
workloadSet a role's default workload.
use_concurrency_controlEnable or disable concurrency control.
READONLYApply the profile's setting as read-only.
CONSTPrevent the role from overriding the setting.
TOAttach the profile to existing roles.

Query API behavior

  • Supported: workload and 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

Error: Unsupported settings profile statement.

Hint:

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

Create a role for the profile.

CREATE ROLE profile_statement_analyst

Create the workload that the profile assigns.

CREATE WORKLOAD profile_statement_workload ON CLUSTER 'default'

Assign the workload and prevent overrides.

CREATE SETTINGS PROFILE profile_statement_profile SETTINGS workload = 'profile_statement_workload' CONST TO profile_statement_analyst

Drop the profile before the role.

DROP SETTINGS PROFILE IF EXISTS profile_statement_profile
DROP ROLE IF EXISTS profile_statement_analyst

Drop the workload after the profile.

DROP WORKLOAD IF EXISTS profile_statement_workload ON CLUSTER 'default'

The parser rejects ALTER SETTINGS PROFILE.

ALTER SETTINGS PROFILE profile_statement_profile SETTINGS workload = 'default'

The parser rejects settings other than the supported scheduling settings.

CREATE SETTINGS PROFILE restricted_profile SETTINGS max_memory_usage = 1 TO profile_statement_analyst

The parser rejects profile inheritance.

CREATE SETTINGS PROFILE restricted_profile IN profile_statement_profile SETTINGS workload = 'default' TO profile_statement_analyst

The parser rejects user targets.

CREATE SETTINGS PROFILE restricted_profile SETTINGS workload = 'default' TO USER analytics_user

The parser rejects other clusters.

CREATE SETTINGS PROFILE restricted_profile ON CLUSTER 'other' SETTINGS workload = 'default' TO profile_statement_analyst