跳至主要内容
跳至主要内容
编辑此页

设置配置文件

设置配置文件是具有相同名称的设置集合。

注意

ClickHouse 还支持 SQL 驱动的工作流来管理设置配置文件。我们建议使用它。

配置文件可以有任何名称。您可以为不同的用户指定相同的配置文件。您可以在设置配置文件中写入的最重要内容是 readonly=1,这可确保只读访问权限。

设置配置文件可以相互继承。要使用继承,请在配置文件中列出的其他设置之前指定一个或多个 profile 设置。当一个设置在不同的配置文件中定义时,最后定义的设置将被使用。

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

示例

安装 web 配置文件。

SET profile = 'web'

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

示例

<!-- Settings profiles -->
<profiles>
    <!-- Default settings -->
    <default>
        <!-- The maximum number of threads when running a single query. -->
        <max_threads>8</max_threads>
    </default>

    <!-- Background operations settings -->
    <background>
        <!-- Re-defining maximum number of threads for background operations -->
        <max_threads>12</max_threads>
    </background>

    <!-- Settings for queries from the user interface -->
    <web>
        <max_rows_to_read>1000000000</max_rows_to_read>
        <max_bytes_to_read>100000000000</max_bytes_to_read>

        <max_rows_to_group_by>1000000</max_rows_to_group_by>
        <group_by_overflow_mode>any</group_by_overflow_mode>

        <max_rows_to_sort>1000000</max_rows_to_sort>
        <max_bytes_to_sort>1000000000</max_bytes_to_sort>

        <max_result_rows>100000</max_result_rows>
        <max_result_bytes>100000000</max_result_bytes>
        <result_overflow_mode>break</result_overflow_mode>

        <max_execution_time>600</max_execution_time>
        <min_execution_speed>1000000</min_execution_speed>
        <timeout_before_checking_execution_speed>15</timeout_before_checking_execution_speed>

        <max_columns_to_read>25</max_columns_to_read>
        <max_temporary_columns>100</max_temporary_columns>
        <max_temporary_non_const_columns>50</max_temporary_non_const_columns>

        <max_subquery_depth>2</max_subquery_depth>
        <max_pipeline_depth>25</max_pipeline_depth>
        <max_ast_depth>50</max_ast_depth>
        <max_ast_elements>100</max_ast_elements>

        <max_sessions_for_user>4</max_sessions_for_user>

        <readonly>1</readonly>
    </web>
</profiles>

示例指定了两个配置文件:defaultweb

default 配置文件具有特殊用途:它必须始终存在,并且在服务器启动时应用。换句话说,default 配置文件包含默认设置。可以通过 default_profile 服务器设置更改默认配置文件的名称。

background 配置文件具有特殊用途:它可能存在于此处,以覆盖后台操作的设置。该参数是可选的,其名称可以通过 background_profile 服务器设置更改。

web 配置文件是一个常规配置文件,可以使用 SET 查询或 HTTP 查询中的 URL 参数进行设置。

    © . This site is unofficial and not affiliated with ClickHouse, Inc.