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

# weight_lowering_* 会话设置

> 自动生成的 weight_lowering_* 分组中的 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)自动生成。

<h2 id="weight_lowering_age_seconds">
  weight\_lowering\_age\_seconds
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.10"},{"label": "0"},{"label": "新增查询设置：在 `fair` 工作负载调度器中，查询运行的挂钟时间超过此阈值后，其权重将被降低。"}]}]} />

适用于 `fair` 工作负载调度器：查询运行的挂钟时间达到此秒数后，其权重将按 `weight_lowering_factor` 降低。设为 `0` (或任意负值) 时禁用该时间阈值。

<h2 id="weight_lowering_cpu_seconds">
  weight\_lowering\_cpu\_seconds
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.10"},{"label": "0"},{"label": "新的查询设置：在 `fair` 工作负载调度器中，查询累计获得的 CPU 秒数达到该阈值后，其权重将被降低。"}]}]} />

适用于 `fair` 工作负载调度器：当查询累计获得的 CPU 秒数达到该值后，其权重将按 `weight_lowering_factor` 降低。此设置作用于 CPU 资源。设置为 `0` (或任意负值) 时将禁用该 CPU 阈值。累计 CPU 指调度器已授予的服务量，在请求被授予时即计入，而不是在实际消耗 CPU 时才计入，因此每个活跃插槽最多会比实际消耗超前一个时间量子 (`cpu_slot_quantum_ns`) 。此设置仅在启用 CPU 插槽抢占 (`cpu_slot_preemption = 1`，即默认值) 时才有意义；若未启用抢占，CPU 插槽按每个插槽的固定开销计费，而非按实际 CPU 时间计费，因此该阈值 (与其他 `fair` CPU 设置一样) 将无法反映实际的 CPU 消耗。

<h2 id="weight_lowering_factor">
  weight\_lowering\_factor
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.10"},{"label": "1"},{"label": "新增查询设置：在 `fair` 工作负载调度器中，查询一旦超过权重降低阈值，即对其权重应用该系数。"}]}]} />

适用于 `fair` 工作负载调度器：一旦查询超过下方任一 `weight_lowering_*` 阈值，其有效权重就会乘以该系数 (仅乘一次) 。取值在 (0, 1) 之间时会降低权重，使调度偏向较短或较新的查询。各阈值的效果不会叠加——最先触发的阈值即施加全部降幅。设为 `1.0` 表示禁用权重降低。该值会被限制在 `[0, 1]` 范围内，因此该系数只会降低查询的权重，而不会提高权重。

<h2 id="weight_lowering_io_bytes">
  weight\_lowering\_io\_bytes
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.10"},{"label": "0"},{"label": "新增查询设置：在 `fair` 工作负载调度器中，查询的 IO 字节数达到该阈值后，其权重将被降低。"}]}]} />

适用于 `fair` 工作负载调度器：当查询的 IO 量达到该字节数后，其权重将按 `weight_lowering_factor` 降低。该设置作用于 IO 资源。设为 `0` (或任意负值) 即禁用 IO 阈值。
