> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# optimize_rewrite_* 세션 설정

> optimize_rewrite_* 그룹에 속하는 ClickHouse 세션 설정입니다.

export const SettingsInfoBlock = ({type, default_value, changeable_without_restart}) => {
  return <div className="not-prose" style={{
    display: "flex",
    flexWrap: "wrap",
    alignItems: "baseline",
    columnGap: "0.5rem",
    rowGap: "0.125rem",
    margin: "0.375rem 0",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <div style={{
    fontWeight: 600,
    opacity: 0.72
  }}>유형</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{type}</div>
      <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>기본값</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{default_value}</div>
      {changeable_without_restart && <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>
          재시작 없이 변경 가능
        </div>}
      {changeable_without_restart && <div style={{
    overflowWrap: "anywhere"
  }}>
          {changeable_without_restart}
        </div>}
    </div>;
};

이러한 설정은 [system.settings](/docs/ko/reference/system-tables/settings)에서 확인할 수 있으며 [소스 코드](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp)를 기반으로 자동 생성됩니다.

<div id="optimize_rewrite_aggregate_function_with_if">
  ## optimize\_rewrite\_aggregate\_function\_with\_if
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

논리적으로 동일한 경우, `if` 표현식을 인수로 받는 집계 함수를 재작성합니다.
예를 들어 `avg(if(cond, col, null))`는 `avgOrNullIf(cond, col)`로 재작성할 수 있습니다. 성능이 향상될 수 있습니다.

<Note>
  분석기(`enable_analyzer = 1`)를 사용할 때만 지원됩니다.
</Note>

<div id="optimize_rewrite_array_exists_to_has">
  ## optimize\_rewrite\_array\_exists\_to\_has
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "1"},{"label": "이제 재작성 전에 유형 호환성을 확인하므로, arrayExists를 has로 재작성하는 최적화가 기본적으로 활성화됩니다."}]}]} />

논리적으로 동일한 경우 arrayExists() 함수를 has()로 재작성합니다. 예를 들어, arrayExists(x -> x = 1, arr)는 has(arr, 1)로 재작성할 수 있습니다.

<div id="optimize_rewrite_has_to_in">
  ## optimize\_rewrite\_has\_to\_in
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "1"},{"label": "새로운 설정"}]}]} />

첫 번째 인수가 상수 배열인 경우 `has` 함수를 `IN`으로 재작성합니다. 예를 들어 `has([1, 2, 3], x)`는 상수 배열에서 성능을 높이기 위해 `x IN [1, 2, 3]`으로 재작성할 수 있습니다.

<div id="optimize_rewrite_like_perfect_affix">
  ## optimize\_rewrite\_like\_perfect\_affix
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.10"},{"label": "1"},{"label": "새로운 설정"}]}]} />

정확한 접두사 또는 접미사를 사용하는 LIKE 표현식(예: `col LIKE 'ClickHouse%'`)을 startsWith 또는 endsWith 함수(예: `startsWith(col, 'ClickHouse')`)로 재작성합니다.

<div id="optimize_rewrite_regexp_functions">
  ## optimize\_rewrite\_regexp\_functions
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "1"},{"label": "새로운 설정"}]}]} />

정규식 관련 함수를 더 단순하고 효율적인 형태로 재작성합니다

<div id="optimize_rewrite_sum_if_to_count_if">
  ## optimize\_rewrite\_sum\_if\_to\_count\_if
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.4"},{"label": "1"},{"label": "정상적으로 동작하는 분석기에서만 사용할 수 있습니다"}]}]} />

논리적으로 동일하면 sumIf() 및 sum(if()) 함수를 countIf() 함수로 재작성합니다
