设置 profile 是一组归在同一名称下的设置。
profile 可以取任意名称。你可以为不同用户指定同一个 profile。在设置 profile 中,最重要的一项是 readonly=1,它可确保只读访问。
设置 profile 之间可以相互继承。要使用继承,请在该 profile 中列出的其他设置之前先指定一个或多个 profile 设置。如果同一个设置在不同的 profile 中都有定义,则以最后定义的为准。
要应用某个 profile 中的全部设置,请设置 profile。
示例:
安装 web profile。
SET profile = 'web'profile 在用户配置文件中定义,通常是 users.xml。
示例:
<!-- 设置 profile -->
<profiles>
<!-- 默认设置 -->
<default>
<!-- 运行单个查询时的最大线程数。 -->
<max_threads>8</max_threads>
</default>
<!-- 后台操作设置 -->
<background>
<!-- 重新定义后台操作的最大线程数 -->
<max_threads>12</max_threads>
</background>
<!-- 来自用户界面的查询设置 -->
<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>该示例指定了两个 profile:default 和 web。
default profile 有一个特殊用途:它必须始终存在,并在服务器启动时应用。换句话说,default profile 包含默认设置。默认 profile 的名称可以通过 default_profile 服务器设置更改。
background profile 也有一个特殊用途:它可用于覆盖后台操作的设置。该参数是可选的,其名称可以通过 background_profile 服务器设置更改。
web profile 是一个常规 profile,可以使用 SET 查询来设置,也可以通过 HTTP 查询中的 URL 参数来设置。