跳至主要内容

创建设置配置文件

创建可以分配给用户或角色的设置配置文件

语法

CREATE SETTINGS PROFILE [IF NOT EXISTS | OR REPLACE] name1 [, name2 [,...]] 
[ON CLUSTER cluster_name]
[IN access_storage_type]
[SETTINGS variable [= value] [MIN [=] min_value] [MAX [=] max_value] [CONST|READONLY|WRITABLE|CHANGEABLE_IN_READONLY] | INHERIT 'profile_name'] [,...]
[TO {{role1 | user1 [, role2 | user2 ...]} | NONE | ALL | ALL EXCEPT {role1 | user1 [, role2 | user2 ...]}}]

ON CLUSTER 子句允许在集群上创建设置配置文件,请参阅分布式 DDL

示例

创建用户

CREATE USER robin IDENTIFIED BY 'password';

创建具有 max_memory_usage 设置的值和约束的 max_memory_usage_profile 设置配置文件,并将其分配给用户 robin

CREATE
SETTINGS PROFILE max_memory_usage_profile SETTINGS max_memory_usage = 100000001 MIN 90000000 MAX 110000000
TO robin