> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-postgresql-tls-support.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# optimize_and_compare_chain_* 세션 설정

> optimize_and_compare_chain_* 생성 그룹에 속한 ClickHouse 세션 설정입니다.

export const VersionHistory = ({rows = []}) => {
  if (rows.length === 0) {
    return null;
  }
  const headers = ["버전", "기본값", "설명"];
  const border = "1px solid rgba(128, 128, 128, 0.3)";
  const cell = {
    border,
    padding: "0.25rem 0.5rem",
    textAlign: "start",
    verticalAlign: "top"
  };
  return <details className="not-prose" style={{
    border,
    borderRadius: "0.5rem",
    margin: "0.5rem 0",
    padding: "0.5rem 0.75rem",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <summary style={{
    cursor: "pointer",
    fontWeight: 600,
    opacity: 0.72
  }}>
        버전 이력
      </summary>
      <table style={{
    borderCollapse: "collapse",
    width: "100%",
    margin: "0.5rem 0 0"
  }}>
        <thead>
          <tr>
            {headers.map(header => <th key={header} style={{
    ...cell,
    fontWeight: 600,
    opacity: 0.72
  }}>
                {header}
              </th>)}
          </tr>
        </thead>
        <tbody>
          {rows.map((row, row_index) => <tr key={row.id ?? row_index}>
              {(row.items ?? []).map((item, item_index) => <td key={item_index} style={{
    ...cell,
    overflowWrap: "anywhere"
  }}>
                  {item?.label}
                </td>)}
            </tr>)}
        </tbody>
      </table>
    </details>;
};

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](/ko/reference/system-tables/settings)에서 확인할 수 있으며, [소스 코드](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp)에서 자동 생성됩니다.

<div id="optimize_and_compare_chain">
  ## optimize\_and\_compare\_chain
</div>

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

필터링 기능을 향상하기 위해 AND 체인에서 상수 비교를 전파합니다. `<`, `<=`, `>`, `>=`, `=` 연산자와 이들의 혼합을 지원합니다. 예를 들어 `(a < b) AND (b < c) AND (c < 5)`는 `(a < b) AND (b < c) AND (c < 5) AND (b < 5) AND (a < 5)`로 확장됩니다.

<div id="optimize_and_compare_chain_max_hash_work">
  ## optimize\_and\_compare\_chain\_max\_hash\_work
</div>

<SettingsInfoBlock type="UInt64" default_value="5000000" />

쿼리 분석 중 `optimize_and_compare_chain` 최적화에 사용할 작업 예산으로, `getTreeHash`가 해시하는 쿼리 트리 노드 수(이 최적화의 주된 비용)로 측정합니다. 최적화 적용 중 해시한 노드 수가 이 값을 초과하면, 해당 쿼리의 나머지 부분에는 이 최적화를 더 이상 적용하지 않습니다. 이를 통해 비교 `AND`-chain이 매우 많거나 매우 큰 쿼리에서, 아무런 folding 없이 이 최적화가 분석 시간의 대부분을 차지할 수 있는 경우에도 분석 시간을 제한할 수 있습니다. 조기에 중단해도 항상 안전합니다. 단지 최적화 적용을 포기할 뿐이며, 결과는 절대 바뀌지 않습니다. 예산 제한을 비활성화하려면 `0`으로 설정하십시오(무제한).
