> ## 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.

# max_execution_* 세션 설정

> max_execution_* 자동 생성 그룹에 속한 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)에서 확인할 수 있으며, [source](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp)로부터 자동 생성됩니다.

<div id="max_execution_speed">
  ## max\_execution\_speed
</div>

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

초당 최대 실행 행 수입니다.
[`timeout_before_checking_execution_speed`](/docs/ko/reference/settings/session-settings/other#timeout_before_checking_execution_speed)
시간이 만료될 때마다 각 데이터 블록에서 이를 확인합니다. 실행 속도가 너무 높으면 속도를 낮춥니다.

<div id="max_execution_speed_bytes">
  ## max\_execution\_speed\_bytes
</div>

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

초당 실행 바이트 수의 최댓값입니다.
[`timeout_before_checking_execution_speed`](/docs/ko/reference/settings/session-settings/other#timeout_before_checking_execution_speed)
시간이 경과하면 각 데이터 블록마다 확인합니다. 실행 속도가 너무 높으면 속도를 낮춥니다.

<div id="max_execution_time">
  ## max\_execution\_time
</div>

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

초 단위의 최대 쿼리 실행 시간입니다.

`max_execution_time` 매개변수는 다소 이해하기 어려울 수 있습니다.
이 설정은 현재 쿼리 실행 속도를 기준으로 보간하여 동작합니다
(이 동작은 [`timeout_before_checking_execution_speed`](/docs/ko/reference/settings/session-settings/other#timeout_before_checking_execution_speed)로 제어됩니다).

예상 실행 시간이 지정된 `max_execution_time`를 초과하면 ClickHouse가 쿼리를 중단합니다. 기본적으로 `timeout_before_checking_execution_speed`는 10초로 설정되어 있습니다. 즉, 쿼리가 10초 동안 실행된 후부터 ClickHouse가 전체 실행 시간을 추정하기 시작합니다. 예를 들어 `max_execution_time`를 3600초(1시간)로 설정한 경우, 예상 시간이 이 3600초 제한을 초과하면 ClickHouse가 쿼리를 종료합니다. `timeout_before_checking_execution_speed`를 0으로 설정하면 ClickHouse는 `max_execution_time`의 기준으로 경과 시간을 사용합니다.

쿼리 런타임이 지정된 초 수를 초과하면 동작은 `timeout_overflow_mode`에 따라 결정되며, 기본값은 `throw`입니다.

<Note>
  타임아웃은 데이터 처리 중 지정된 지점에서만 확인되므로, 쿼리도 해당 지점에서만 중지될 수 있습니다.
  현재는 집계 상태의 병합 중이나 쿼리 분석 중에는 중지할 수 없으므로, 실제 실행 시간은 이 설정값보다 길어질 수 있습니다.
</Note>

<div id="max_execution_time_leaf">
  ## max\_execution\_time\_leaf
</div>

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

의미적으로는 [`max_execution_time`](/docs/ko/reference/settings/session-settings/max-execution#max_execution_time)와 유사하지만,
분산 쿼리 또는 원격 쿼리에서 리프 노드에만 적용됩니다.

예를 들어, 리프 노드의 실행 시간을 `10s`로 제한하되
초기 노드에는 제한을 두지 않으려는 경우, 중첩된 서브쿼리 설정에 `max_execution_time`을 두는 대신 다음과 같이 설정합니다:

```sql theme={null}
SELECT count()
FROM cluster(cluster, view(SELECT * FROM t SETTINGS max_execution_time = 10));
```

쿼리 설정으로 `max_execution_time_leaf`를 사용할 수 있습니다.

```sql theme={null}
SELECT count()
FROM cluster(cluster, view(SELECT * FROM t)) SETTINGS max_execution_time_leaf = 10;
```
