clickhouse20.12.3参数配置

1.users.xml配置

注意:用户和查询级别设置在users.xml文件。

通过以下语句可以查询及临时设置:

localhost :) select * from system.settings where name='max_execution_time';

SELECT *
FROM system.settings
WHERE name = 'max_execution_time'

Query id: 522b236f-6752-4590-8037-57be9f5a337a

┌─name───────────────┬─value─┬─changed─┬─description─┬─min──┬─max──┬─readonly─┬─type────┐
│ max_execution_time │ 00 │             │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │        0 │ Seconds │
└────────────────────┴───────┴─────────┴─────────────┴──────┴──────┴──────────┴─────────┘

1 rows in set. Elapsed: 0.003 sec. 

localhost :) 
localhost :) SET max_execution_time = 30;    #临时设置

SET max_execution_time = 30

Query id: 7f17aa03-4857-445e-8004-0df49e845f49

Ok.

0 rows in set. Elapsed: 0.001 sec. 

localhost :) 
localhost :) select * from system.settings where name='max_execution_time';

SELECT *
FROM system.settings
WHERE name = 'max_execution_time'

Query id: e6fbda0b-e627-4ccc-b64f-c0d537c86def

┌─name───────────────┬─value─┬─changed─┬─description─┬─min──┬─max──┬─readonly─┬─type────┐
│ max_execution_time │ 301 │             │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │        0 │ Seconds │
└────────────────────┴───────┴─────────┴─────────────┴──────┴──────┴──────────┴─────────┘

1 rows in set. Elapsed: 0.002 sec. 

localhost :) 

(1).max_memory_usage 

用于在单个服务器上运行查询的最大RAM量。在默认配置文件中,最大值为10GB。该设置不考虑计算机上的可用内存量或内存总量。该限制适用于单个服务器中的单个查询。您可以使用 SHOW PROCESSLIST 查看每个查询的当前内存消耗。此外,还会跟踪每个查询的内存消耗峰值并将其写入日志。

不监视某些聚合函数的状态的内存使用情况:

未完全跟踪聚合函数的状态的内存使用情况 min, max, any, anyLast, argMin, argMax 从 String 和 Array 。
内存消耗也受到参数的限制 max_memory_usage_for_user 和 max_memory_usage_for_all_queries.

(2).max_memory_usage_for_user

用于在单个服务器上运行用户查询的最大RAM量。默认情况下不受限制(max_memory_usage_for_user = 0)

(3).max_memory_usage_for_all_queries

用于在单个服务器上运行所有查询的最大RAM数量。

(4).max_result_rows 

限制结果中的行数。 还检查子查询,并在运行分布式查询的部分时在远程服务器上。

(5).max_execution_time

最大查询执行时间(以秒为单位)。

此时,不会检查其中一个排序阶段,也不会在合并和最终确定聚合函数时进行检查。

官方地址:https://clickhouse.tech/docs/zh/operations/settings/query-complexity/

2.修改users.xml文件使其永久生效

(1).修改max_execution_time(以秒为单位),此处设置为600秒

<max_execution_time>600</max_execution_time>

修改后,重启clickhouse

systemctl restart clickhouse-server.service

然后查询

localhost :) select * from system.settings where name='max_execution_time';

SELECT *
FROM system.settings
WHERE name = 'max_execution_time'

Query id: 15886c4c-e7a0-40fc-8ec4-45021a222c84

┌─name───────────────┬─value─┬─changed─┬─description─┬─min──┬─max──┬─readonly─┬─type────┐
│ max_execution_time │ 6001 │             │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │        0 │ Seconds │
└────────────────────┴───────┴─────────┴─────────────┴──────┴──────┴──────────┴─────────┘

1 rows in set. Elapsed: 0.003 sec. 

localhost :)

官方地址:https://clickhouse.tech/docs/zh/operations/settings/settings-profiles/

3.config.xml配置

 

posted @ 2020-12-20 12:26  雍洲无名  阅读(1200)  评论(0编辑  收藏  举报