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

> max_memory_usage_* 생성 그룹에 속한 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="max_memory_usage">
  ## max\_memory\_usage
</div>

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

Cloud 기본값: 레플리카의 RAM 용량에 따라 달라집니다.

단일 서버에서 쿼리를 실행할 때 사용할 수 있는 최대 RAM 용량입니다.
값이 `0`이면 무제한을 의미합니다.

이 설정은 사용 가능한 메모리 양이나 머신의 전체 메모리 용량을 고려하지 않습니다.
이 제한은 단일 서버 내 단일 쿼리에 적용됩니다.

`SHOW PROCESSLIST`를 사용하면 각 쿼리의 현재 메모리 사용량을 확인할 수 있습니다.
최대 메모리 사용량은 각 쿼리별로 추적되어 로그에 기록됩니다.

다음 집계 함수의 `String` 및 `Array` 인수의 상태에 대해서는
메모리 사용량이 완전히 추적되지 않습니다.

* `min`
* `max`
* `any`
* `anyLast`
* `argMin`
* `argMax`

메모리 사용량은 [`max_memory_usage_for_user`](/docs/ko/reference/settings/session-settings/max-memory-usage#max_memory_usage_for_user)
및 [`max_server_memory_usage`](/docs/ko/reference/settings/server-settings/settings#max_server_memory_usage) 매개변수에 의해서도 제한됩니다.

<div id="max_memory_usage_for_user">
  ## max\_memory\_usage\_for\_user
</div>

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

단일 server에서 사용자의 쿼리를 실행할 때 사용할 수 있는 RAM의 최대 크기입니다. 0은 제한이 없음을 의미합니다.

기본적으로는 이 값에 제한이 없습니다(`max_memory_usage_for_user = 0`).

[`max_memory_usage`](/docs/ko/reference/settings/session-settings/max-memory-usage#max_memory_usage) 설명도 참고하십시오.

예를 들어 `clickhouse_read`라는 이름의 사용자에 대해 `max_memory_usage_for_user`를 1000바이트로 설정하려면 다음 SQL 문을 사용할 수 있습니다.

```sql theme={null}
ALTER USER clickhouse_read SETTINGS max_memory_usage_for_user = 1000;
```

클라이언트에서 로그아웃한 후 다시 로그인한 다음 `getSetting` 함수를 사용하여 제대로 적용되었는지 확인할 수 있습니다:

```sql theme={null}
SELECT getSetting('max_memory_usage_for_user');
```
