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

# lightweight_* 会话设置

> 属于 lightweight_* 生成组的 ClickHouse 会话设置。

export const VersionHistory = ({rows = []}) => {
  if (rows.length === 0) {
    return null;
  }
  const headers = ["版本", "默认值", "注释"];
  const border = "1px solid rgba(128, 128, 128, 0.3)";
  const cell = {
    border,
    padding: "0.25rem 0.5rem",
    textAlign: "start",
    verticalAlign: "top"
  };
  return <details className="not-prose" style={{
    border,
    borderRadius: "0.5rem",
    margin: "0.5rem 0",
    padding: "0.5rem 0.75rem",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <summary style={{
    cursor: "pointer",
    fontWeight: 600,
    opacity: 0.72
  }}>
        版本历史
      </summary>
      <table style={{
    borderCollapse: "collapse",
    width: "100%",
    margin: "0.5rem 0 0"
  }}>
        <thead>
          <tr>
            {headers.map(header => <th key={header} style={{
    ...cell,
    fontWeight: 600,
    opacity: 0.72
  }}>
                {header}
              </th>)}
          </tr>
        </thead>
        <tbody>
          {rows.map((row, row_index) => <tr key={row.id ?? row_index}>
              {(row.items ?? []).map((item, item_index) => <td key={item_index} style={{
    ...cell,
    overflowWrap: "anywhere"
  }}>
                  {item?.label}
                </td>)}
            </tr>)}
        </tbody>
      </table>
    </details>;
};

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](/zh/reference/system-tables/settings) 中查看，并根据 [源代码](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp) 自动生成。

<div id="lightweight_delete_mode">
  ## lightweight\_delete\_mode
</div>

<SettingsInfoBlock type="LightweightDeleteMode" default_value="alter_update" />

轻量级删除过程中执行的内部更新查询模式。

可能的值：

* `alter_update` - 运行会创建重量级变更的 `ALTER UPDATE` 查询。
* `lightweight_update` - 如果可以，则运行轻量级更新；否则运行 `ALTER UPDATE`。
* `lightweight_update_force` - 如果可以，则运行轻量级更新；否则抛出异常。

<div id="lightweight_deletes_sync">
  ## lightweight\_deletes\_sync
</div>

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

与 [`mutations_sync`](/zh/reference/settings/session-settings/mutations#mutations_sync) 相同，但仅控制轻量级删除的执行。

可能的值：

| 值   | 描述                                                                                      |
| --- | --------------------------------------------------------------------------------------- |
| `0` | 变更将异步执行。                                                                                |
| `1` | 查询会等待当前服务器上的轻量级删除完成。                                                                    |
| `2` | 查询会等待所有副本 (如果存在) 上的轻量级删除完成。                                                             |
| `3` | 查询仅等待活跃副本。仅 `SharedMergeTree` 支持。对于 `ReplicatedMergeTree`，其行为与 `mutations_sync = 2` 相同。 |

**另请参阅**

* [ALTER 查询的同步性](/zh/reference/statements/alter/index#synchronicity-of-alter-queries)
* [变更](/zh/reference/statements/alter/index#mutations)

Cloud 默认值：`1`。
