2020-07-09 15:10:35 +00:00
|
|
|
---
|
2022-08-28 14:53:34 +00:00
|
|
|
slug: /en/sql-reference/statements/create/settings-profile
|
2022-04-09 13:29:05 +00:00
|
|
|
sidebar_position: 43
|
|
|
|
sidebar_label: SETTINGS PROFILE
|
2022-08-29 16:19:50 +00:00
|
|
|
title: "CREATE SETTINGS PROFILE"
|
2020-07-09 15:10:35 +00:00
|
|
|
---
|
|
|
|
|
2023-03-18 02:45:43 +00:00
|
|
|
Creates [settings profiles](../../../guides/sre/user-management/index.md#settings-profiles-management) that can be assigned to a user or a role.
|
2020-07-09 15:10:35 +00:00
|
|
|
|
|
|
|
Syntax:
|
|
|
|
|
|
|
|
``` sql
|
2022-12-08 13:17:55 +00:00
|
|
|
CREATE SETTINGS PROFILE [IF NOT EXISTS | OR REPLACE] name1 [ON CLUSTER cluster_name1]
|
2021-01-23 13:14:01 +00:00
|
|
|
[, name2 [ON CLUSTER cluster_name2] ...]
|
2022-09-09 12:01:11 +00:00
|
|
|
[SETTINGS variable [= value] [MIN [=] min_value] [MAX [=] max_value] [CONST|READONLY|WRITABLE|CHANGEABLE_IN_READONLY] | INHERIT 'profile_name'] [,...]
|
2020-07-09 15:10:35 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
`ON CLUSTER` clause allows creating settings profiles on a cluster, see [Distributed DDL](../../../sql-reference/distributed-ddl.md).
|
|
|
|
|
2022-06-02 10:55:18 +00:00
|
|
|
## Example
|
2020-07-09 15:10:35 +00:00
|
|
|
|
2023-02-28 20:38:31 +00:00
|
|
|
Create a user:
|
|
|
|
```sql
|
|
|
|
CREATE USER robin IDENTIFIED BY 'password';
|
|
|
|
```
|
|
|
|
|
2020-07-09 15:10:35 +00:00
|
|
|
Create the `max_memory_usage_profile` settings profile with value and constraints for the `max_memory_usage` setting and assign it to user `robin`:
|
|
|
|
|
|
|
|
``` sql
|
2023-03-18 02:45:43 +00:00
|
|
|
CREATE
|
|
|
|
SETTINGS PROFILE max_memory_usage_profile SETTINGS max_memory_usage = 100000001 MIN 90000000 MAX 110000000
|
2023-02-28 20:38:31 +00:00
|
|
|
TO robin
|
2020-07-09 15:10:35 +00:00
|
|
|
```
|