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

> 경량 업데이트 패치 적용 문서

# 경량 업데이트 패치 적용

export const galaxyOnClick = eventName => () => {
  try {
    if (typeof window !== "undefined" && window.galaxy && eventName) {
      window.galaxy.track(eventName, {
        interaction: "click"
      });
    }
  } catch (e) {}
};

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}>
                <Icon />
                <span>Beta</span>
            </a>;
  }
  return <div className="betaBadge">
            <Icon />
            <span>
                Beta feature. 
                <u>
                    <a href="/docs/beta-and-experimental-features#beta-features">
                        Learn more.
                    </a>
                </u>
            </span>
        </div>;
};

```sql theme={null}
ALTER TABLE [db.]table [ON CLUSTER cluster] APPLY PATCHES [IN PARTITION partition_id]
```

이 명령은 [lightweight `UPDATE`](/ko/reference/statements/update) SQL 문으로 생성된 패치 파트를 물리적으로 머티리얼라이즈하도록 수동으로 트리거합니다. 영향을 받는 컬럼만 다시 작성하여 보류 중인 패치를 데이터 파트에 강제로 적용합니다.

<Note>
  * [`MergeTree`](/ko/reference/engines/table-engines/mergetree-family/mergetree) 계열의 테이블([복제된](/ko/reference/engines/table-engines/mergetree-family/replication) 테이블 포함)에서만 작동합니다.
  * 이는 mutation 작업이며 백그라운드에서 비동기적으로 실행됩니다.
</Note>

<div id="when-to-use">
  ## APPLY PATCHES를 사용하는 경우
</div>

<Tip>
  일반적으로 `APPLY PATCHES`는 사용할 필요가 없습니다
</Tip>

패치 파트는 보통 [`apply_patches_on_merge`](/ko/reference/settings/merge-tree-settings#apply_patches_on_merge) 설정이 활성화되어 있으면(기본값) 머지 중에 자동으로 적용됩니다. 하지만 다음과 같은 경우에는 패치 적용을 수동으로 트리거하는 것이 유용할 수 있습니다:

* `SELECT` 쿼리에서 패치를 적용할 때 발생하는 오버헤드를 줄이려는 경우
* 여러 패치 파트가 쌓이기 전에 통합하려는 경우
* 패치가 이미 구체화된 상태로 백업 또는 내보내기를 위해 데이터를 준비하려는 경우
* `apply_patches_on_merge`가 비활성화되어 있어 패치 적용 시점을 직접 제어하려는 경우

<div id="examples">
  ## 예시
</div>

테이블의 대기 중인 모든 패치를 적용합니다:

```sql theme={null}
ALTER TABLE my_table APPLY PATCHES;
```

패치를 특정 파티션에만 적용하십시오:

```sql theme={null}
ALTER TABLE my_table APPLY PATCHES IN PARTITION '2024-01';
```

다른 작업과 함께 수행합니다:

```sql theme={null}
ALTER TABLE my_table APPLY PATCHES, UPDATE column = value WHERE condition;
```

<div id="monitor">
  ## 패치 적용 모니터링
</div>

[`system.mutations`](/ko/reference/system-tables/mutations) 테이블을 사용해 패치 적용 진행 상태를 모니터링할 수 있습니다:

```sql theme={null}
SELECT * FROM system.mutations
WHERE table = 'my_table' AND command LIKE '%APPLY PATCHES%';
```

<div id="see-also">
  ## 관련 항목
</div>

* [Lightweight `UPDATE`](/ko/reference/statements/update) - 경량 업데이트를 사용해 패치 파트 생성
* [`apply_patches_on_merge` setting](/ko/reference/settings/merge-tree-settings#apply_patches_on_merge) - 머지 중 패치가 자동으로 적용되도록 제어
