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

# distributed_* 세션 설정

> distributed_*로 생성된 그룹의 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="distributed_aggregation_memory_efficient">
  ## distributed\_aggregation\_memory\_efficient
</div>

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

분산 집계의 메모리 절약 모드 활성화 여부입니다.

<div id="distributed_connections_pool_size">
  ## distributed\_connections\_pool\_size
</div>

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

단일 분산 테이블에 대한 모든 쿼리를 분산 처리할 때 원격 서버와 동시에 맺을 수 있는 최대 연결 수입니다. 이 값은 클러스터의 서버 수 이상으로 설정하는 것이 좋습니다.

<div id="distributed_foreground_insert">
  ## distributed\_foreground\_insert
</div>

**별칭**: `insert_distributed_sync`

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

[분산](/docs/ko/reference/engines/table-engines/special/distributed) 테이블에 데이터를 동기식으로 삽입할지 여부를 설정합니다.

기본적으로 `Distributed` 테이블에 데이터를 삽입하면 ClickHouse 서버는 데이터를 백그라운드 모드로 클러스터 노드에 전송합니다. `distributed_foreground_insert=1`이면 데이터가 동기식으로 처리되며, 모든 세그먼트에 데이터가 저장된 후에만 `INSERT` 작업이 성공합니다(`internal_replication`이 true이면 각 세그먼트에서 최소 1개의 레플리카에 저장).

가능한 값:

* `0` — 데이터가 백그라운드 모드로 삽입됩니다.
* `1` — 데이터가 동기식 모드로 삽입됩니다.

Cloud 기본값: `1`.

**관련 항목**

* [분산 테이블 엔진](/docs/ko/reference/engines/table-engines/special/distributed)
* [분산 테이블 관리](/docs/ko/reference/statements/system#managing-distributed-tables)

<div id="distributed_group_by_no_merge">
  ## distributed\_group\_by\_no\_merge
</div>

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

분산 쿼리 처리에서 서로 다른 서버의 집계 상태를 머지하지 않습니다. 서로 다른 세그먼트에 서로 다른 키가 있는 것이 확실할 때 사용할 수 있습니다.

가능한 값:

* `0` — 비활성화됨(최종 쿼리 처리는 시작 노드에서 수행됩니다).
* `1` - 분산 쿼리 처리에서 서로 다른 서버의 집계 상태를 머지하지 않습니다(쿼리는 세그먼트에서 완전히 처리되며, 시작 노드는 데이터만 프록시합니다). 서로 다른 세그먼트에 서로 다른 키가 있는 것이 확실할 때 사용할 수 있습니다.
* `2` - `1`과 같지만 `ORDER BY` 및 `LIMIT`는 시작 노드에 적용합니다(`distributed_group_by_no_merge=1`처럼 쿼리가 원격 노드에서 완전히 처리되는 경우에는 적용할 수 없습니다). `ORDER BY` 및/또는 `LIMIT`가 있는 쿼리에 사용할 수 있습니다.

**예시**

```sql theme={null}
SELECT *
FROM remote('127.0.0.{2,3}', system.one)
GROUP BY dummy
LIMIT 1
SETTINGS distributed_group_by_no_merge = 1
FORMAT PrettyCompactMonoBlock

┌─dummy─┐
│     0 │
│     0 │
└───────┘
```

```sql theme={null}
SELECT *
FROM remote('127.0.0.{2,3}', system.one)
GROUP BY dummy
LIMIT 1
SETTINGS distributed_group_by_no_merge = 2
FORMAT PrettyCompactMonoBlock

┌─dummy─┐
│     0 │
└───────┘
```

<div id="distributed_insert_skip_read_only_replicas">
  ## distributed\_insert\_skip\_read\_only\_replicas
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "0"},{"label": "true이면 분산에 INSERT할 때 읽기 전용 레플리카를 건너뜁니다"}]}]} />

분산에 INSERT하는 쿼리에서 읽기 전용 레플리카를 건너뛸 수 있도록 합니다.

가능한 값:

* 0 — INSERT는 평소처럼 수행되며, 읽기 전용 레플리카로 전송되면 실패합니다
* 1 — 시작 노드가 데이터를 세그먼트로 보내기 전에 읽기 전용 레플리카를 건너뜁니다.

<div id="distributed_product_mode">
  ## distributed\_product\_mode
</div>

<SettingsInfoBlock type="DistributedProductMode" default_value="deny" />

[분산 서브쿼리](/docs/ko/reference/statements/in)의 동작을 변경합니다.

ClickHouse는 쿼리에 분산 테이블의 곱이 포함된 경우, 즉 분산 테이블에 대한 쿼리에 분산 테이블용 non-GLOBAL 서브쿼리가 포함된 경우 이 설정을 적용합니다.

제한 사항:

* IN 및 JOIN 서브쿼리에만 적용됩니다.
* FROM 절에서 2개 이상의 세그먼트를 포함하는 분산 테이블을 사용하는 경우에만 적용됩니다.
* 서브쿼리가 2개 이상의 세그먼트를 포함하는 분산 테이블에 관련된 경우에만 적용됩니다.
* 테이블 값 [remote](/docs/ko/reference/functions/table-functions/remote) 함수에는 사용되지 않습니다.

가능한 값:

* `deny` — 기본값입니다. 이러한 유형의 서브쿼리 사용을 금지합니다("Double-distributed in/JOIN subqueries is denied" 예외를 반환합니다).
* `local` — 서브쿼리의 데이터베이스와 테이블을 대상 서버(세그먼트)의 로컬 데이터베이스 및 테이블로 바꾸고, 일반 `IN`/`JOIN`은 그대로 유지합니다.
* `global` — `IN`/`JOIN` 쿼리를 `GLOBAL IN`/`GLOBAL JOIN`으로 바꿉니다.
* `allow` — 이러한 유형의 서브쿼리 사용을 허용합니다.

<div id="distributed_push_down_limit">
  ## distributed\_push\_down\_limit
</div>

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

각 세그먼트에 [LIMIT](/docs/ko/reference/settings/session-settings/other#limit)를 개별적으로 적용할지 여부를 설정합니다.

이를 통해 다음을 방지할 수 있습니다.

* 네트워크를 통해 불필요한 추가 행을 전송하는 것
* 시작 노드에서 LIMIT을 초과하는 행을 처리하는 것

21.9 버전부터는 `distributed_push_down_limit`가 아래 조건 중 하나 이상이 충족되는 경우에만 쿼리 실행을 변경하므로, 더 이상 부정확한 결과가 발생하지 않습니다.

* [distributed\_group\_by\_no\_merge](/docs/ko/reference/settings/session-settings/distributed#distributed_group_by_no_merge) > 0.
* 쿼리에 `GROUP BY`/`DISTINCT`/`LIMIT BY`는 **없고**, `ORDER BY`/`LIMIT`는 있습니다.
* 쿼리에 `GROUP BY`/`DISTINCT`/`LIMIT BY`와 `ORDER BY`/`LIMIT`가 **있으며**, 다음 조건을 만족합니다.
  * [optimize\_skip\_unused\_shards](/docs/ko/reference/settings/session-settings/optimize-skip#optimize_skip_unused_shards)가 활성화되어 있습니다.
  * [optimize\_distributed\_group\_by\_sharding\_key](/docs/ko/reference/settings/session-settings/optimize#optimize_distributed_group_by_sharding_key)가 활성화되어 있습니다.

가능한 값:

* 0 — 비활성화됨.
* 1 — 활성화됨.

관련 항목:

* [distributed\_group\_by\_no\_merge](/docs/ko/reference/settings/session-settings/distributed#distributed_group_by_no_merge)
* [optimize\_skip\_unused\_shards](/docs/ko/reference/settings/session-settings/optimize-skip#optimize_skip_unused_shards)
* [optimize\_distributed\_group\_by\_sharding\_key](/docs/ko/reference/settings/session-settings/optimize#optimize_distributed_group_by_sharding_key)
