설정 프로필
설정 프로필 (Settings profiles)
설정 프로필(settings profile)은 같은 이름 아래에 묶어 놓은 설정들의 모음이에요. 프로필을 하나 만들어 두면 여러 설정을 한 번에 손쉽게 적용할 수 있어요.
출처: 문서
본문
설정 프로필은 같은 이름 아래에 묶인 설정들의 모음이에요.
참고: 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>
이 예시는 default와 web 두 개의 프로필을 지정하고 있어요.
default 프로필은 특별한 용도가 있어요. 항상 존재해야 하며 서버를 시작할 때 적용돼요. 다시 말해 default 프로필에는 기본 설정이 들어 있어요. 기본 프로필의 이름은 default_profile 서버 설정으로 바꿀 수 있어요.
background 프로필도 특별한 용도가 있어요. 백그라운드 작업의 설정을 재정의하기 위해 존재할 수 있어요. 이 파라미터는 선택 사항이며 그 이름은 background_profile 서버 설정으로 바꿀 수 있어요.
web 프로필은 SET 쿼리나 HTTP 쿼리의 URL 파라미터로 설정할 수 있는 일반적인 프로필이에요.