> ## 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_aggregation_in_order_* 세션 설정

> optimize_aggregation_in_order_* 생성 그룹에 속한 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_aggregation_in_order">
  ## optimize\_aggregation\_in\_order
</div>

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

[MergeTree](/docs/ko/reference/engines/table-engines/mergetree-family/mergetree) 테이블에서 정렬 순서에 맞춰 데이터를 집계하는 [SELECT](/docs/ko/reference/statements/select/index) 쿼리의 [GROUP BY](/docs/ko/reference/statements/select/group-by) 최적화를 활성화합니다.

가능한 값:

* 0 — `GROUP BY` 최적화가 비활성화됩니다.
* 1 — `GROUP BY` 최적화가 활성화됩니다.

**관련 항목**

* [GROUP BY 최적화](/docs/ko/reference/statements/select/group-by#group-by-optimization-depending-on-table-sorting-key)

<div id="optimize_aggregation_in_order_limit">
  ## optimize\_aggregation\_in\_order\_limit
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.7"},{"label": "1"},{"label": "`ORDER BY`가 `GROUP BY` 정렬 지정의 접두사인 경우, 충분한 그룹이 생성되면 조기에 종료할 수 있도록 `LIMIT`을 aggregation-in-order에 푸시하는 새로운 설정입니다."}]}]} />

활성화되어 있고 aggregation in order가 사용 중이면, 충분한 그룹이 생성된 후 조기에 종료할 수 있도록 `LIMIT`을 집계 단계에 푸시합니다. 이렇게 하면 ORDER BY가 GROUP BY 키 접두사와 일치할 때 읽는 데이터 양을 줄일 수 있습니다. `rows_before_limit_at_least`에 보고되는 값이 줄어들 수 있으므로, 정확한 개수가 필요하면 `exact_rows_before_limit`를 사용하십시오.
