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

# columns_cache_* 세션 설정

> 자동 생성된 columns_cache_* 그룹에 속한 ClickHouse 세션 설정입니다.

export const BetaBadge = ({link, galaxyTrack, galaxyEvent}) => {
  if (link) {
    return <a href={link} target="_blank" rel="noopener noreferrer" className="betaBadge" onClick={galaxyTrack && galaxyEvent ? galaxyOnClick(galaxyEvent) : undefined}>
                <span>베타</span>
            </a>;
  }
  return <a href="https://clickhouse.com/docs/reference/settings/beta-and-experimental-features#beta-features" className="betaBadge">
            <span>베타 기능</span>
        </a>;
};

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)를 기반으로 자동 생성됩니다.

<h2 id="columns_cache_max_bytes_to_write_to_cache">
  columns\_cache\_max\_bytes\_to\_write\_to\_cache
</h2>

<BetaBadge />

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.10"},{"label": "0"},{"label": "새로운 설정: 컬럼 캐시에 기록되는 바이트 수에 대한 쿼리별 소프트 임계값입니다. 권고성 값이므로 하나의 리더가 한 배치로 기록하는 엔트리만큼 초과될 수 있습니다(0 = 현재 컬럼 캐시 크기 제한의 절반이며, 이 제한은 메모리 압력 상황에서 줄어듭니다)."}]}]} />

단일 쿼리가 컬럼 캐시에 기록하는 바이트 수에 대한 쿼리별 소프트 임계값입니다. 쿼리 실행 중 기록된 바이트 수를 집계하며, 카운터가 이 값에 도달하면 해당 쿼리가 끝날 때까지 이후의 캐시 기록을 건너뜁니다. 이 값은 엄격한 상한이 아닌 권고성 임계값입니다. 리더는 읽어 들인 그래뉼의 엔트리를 누적했다가 한 배치로 캐시에 기록하며, 임계값을 넘기는 배치는 카운터에 반영되기 전에 전부 저장됩니다. 따라서 실제 기록량은 하나의 리더가 두 번의 기록 사이에 누적하는 엔트리(읽는 컬럼마다 약 65536개 행으로 구성된 stripe당 엔트리 1개)만큼 이 값을 초과할 수 있으며, 여러 리더가 동시에 실행되면 리더마다 그만큼씩 더 초과할 수 있습니다. 이 설정은 캐시 사용량을 정확히 제한하기 위한 것이 아니라, 대규모 스캔 하나가 유용한 데이터를 캐시에서 밀어내지 않도록 하기 위한 것입니다.

값이 `0`이면 컬럼 캐시의 현재 크기 제한의 절반을 사용합니다. 이 제한은 구성된 `columns_cache_size` 값이며, 메모리 압력으로 캐시가 축소된 동안에는 이보다 작아집니다(`ColumnsCacheSizeLimit` 메트릭 참조).

<h2 id="columns_cache_max_estimated_bytes_to_write_to_cache">
  columns\_cache\_max\_estimated\_bytes\_to\_write\_to\_cache
</h2>

<BetaBadge />

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.10"},{"label": "0"},{"label": "새로운 설정: 컬럼 캐시 쓰기를 허용하는 기준으로, 쿼리가 읽을 것으로 예상되는 비압축 바이트의 상한입니다(0 = 현재 컬럼 캐시 크기 한도의 절반이며, 이 한도는 메모리 압력 상황에서 줄어듭니다)."}]}]} />

쿼리가 `MergeTree` 파트에서 읽을 데이터의 예상 크기가 이 값을 초과하면 해당 쿼리 전체에서 컬럼 캐시(columns cache) 쓰기가 금지됩니다. 예상 크기는 캐시 사용량을 산정하는 단위인 비압축 바이트를 기준으로 하며, 쿼리가 읽는 컬럼(`PREWHERE`, 뮤테이션 및 패치 파트 컬럼 포함)의 크기를 선택된 마크 범위에 비례하도록 환산하여 구합니다. 이 전체 크기는 쿼리가 데이터를 읽기 전에 미리 해당 쿼리에 할당됩니다. 이를 통해 대규모 스캔 하나가 캐시의 유용한 데이터를 밀어내거나, 캐시에 남아 있을 수 없는 데이터를 캐시로 복사하는 것을 방지합니다.

값이 `0`이면 컬럼 캐시의 현재 크기 한도의 절반을 사용합니다. 서버 메모리에 여유가 있을 때 이 한도는 구성된 `columns_cache_size`와 같지만, 메모리 압력 상황에서는 캐시가 줄어들며(`ColumnsCacheSizeLimit` 메트릭 참조) 기본 허용량도 함께 줄어듭니다. 기본 `columns_cache_size_ratio`를 사용하면 한도의 절반이 캐시의 수습(probationary) 세그먼트 크기와 같으므로, 게이트를 통과한 쿼리의 데이터는 한 번에 모두 캐시될 수 있습니다.

실행 중에 마크 범위를 제외하는 읽기에는 이 게이트가 적용되지 않습니다. `use_indexes_refiner_in_read_pools`가 활성화된 경우가 이에 해당합니다. 이러한 읽기가 선택된 마크 중 실제로 얼마나 접근하는지는 각 작업이 분할될 때에야 결정되므로, 위의 예상치는 쿼리가 실제로 읽지 않는 마크까지 포함하는 상한값이 됩니다. 이러한 읽기에서는 대신 `columns_cache_max_bytes_to_write_to_cache`가 쓰기량을 제한합니다.
