设置配置

设置配置是设置的集合,并按照相同的名称进行分组。

note “信息” ClickHouse 还支持用 SQL驱动的工作流 管理设置配置。我们建议使用它。

设置配置可以任意命名。你可以为不同的用户指定相同的设置配置。您可以在设置配置中写入的最重要的内容是 readonly=1,这将确保只读访问。

设置配置可以彼此继承。要使用继承,请在文件中列举的其他设置之前,指定一个或多个 profile 设置。如果在不同的设置配置中定义了同一个设置,则使用最新的定义。

要应用设置配置中的所有设置,请设定 profile 设置。

示例:

添加 web 配置。

  1. SET profile = 'web'

设置配置在用户配置文件中声明。这通常是指 users.xml.

示例:

  1. <!-- Settings profiles -->
  2. <profiles>
  3. <!-- Default settings -->
  4. <default>
  5. <!-- The maximum number of threads when running a single query. -->
  6. <max_threads>8</max_threads>
  7. </default>
  8. <!-- Settings for quries from the user interface -->
  9. <web>
  10. <max_rows_to_read>1000000000</max_rows_to_read>
  11. <max_bytes_to_read>100000000000</max_bytes_to_read>
  12. <max_rows_to_group_by>1000000</max_rows_to_group_by>
  13. <group_by_overflow_mode>any</group_by_overflow_mode>
  14. <max_rows_to_sort>1000000</max_rows_to_sort>
  15. <max_bytes_to_sort>1000000000</max_bytes_to_sort>
  16. <max_result_rows>100000</max_result_rows>
  17. <max_result_bytes>100000000</max_result_bytes>
  18. <result_overflow_mode>break</result_overflow_mode>
  19. <max_execution_time>600</max_execution_time>
  20. <min_execution_speed>1000000</min_execution_speed>
  21. <timeout_before_checking_execution_speed>15</timeout_before_checking_execution_speed>
  22. <max_columns_to_read>25</max_columns_to_read>
  23. <max_temporary_columns>100</max_temporary_columns>
  24. <max_temporary_non_const_columns>50</max_temporary_non_const_columns>
  25. <max_subquery_depth>2</max_subquery_depth>
  26. <max_pipeline_depth>25</max_pipeline_depth>
  27. <max_ast_depth>50</max_ast_depth>
  28. <max_ast_elements>100</max_ast_elements>
  29. <readonly>1</readonly>
  30. </web>
  31. </profiles>

这个示例指定了两个配置: defaultweb

这个 default 配置有一个特殊用途:它必须始终存在并在启动服务时应用。换句话说, default 配置包含默认设置。

web 配置是一个常规的配置,它可以通过 SET 查询进行设定,也可以通过在HTTP查询中使用URL参数进行设定。

原始文章