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

# read_in_* 会话设置

> ClickHouse 在自动生成的 read_in_* 组中的会话设置。

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

<div id="read_in_order_two_level_merge_threshold">
  ## read\_in\_order\_two\_level\_merge\_threshold
</div>

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

按主键顺序进行多线程读取时，触发 预合并 步骤所需读取的最少 parts 数量。

<div id="read_in_order_use_buffering">
  ## read\_in\_order\_use\_buffering
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.7"},{"label": "1"},{"label": "按主键顺序读取时，在合并前先进行缓冲"}]}]} />

按主键顺序读取时，在合并前先进行缓冲。这样可以提高查询执行的并行度

<div id="read_in_order_use_virtual_row">
  ## read\_in\_order\_use\_virtual\_row
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.11"},{"label": "0"},{"label": "按主键或其单调函数的顺序读取时，使用虚拟行。在跨多个 parts 搜索时，这很有用，因为只会访问相关的部分。"}]}]} />

按主键或其单调函数的顺序读取时，使用虚拟行。在跨多个 parts 搜索时，这很有用，因为只会访问相关的部分。

<div id="read_in_order_use_virtual_row_per_block">
  ## read\_in\_order\_use\_virtual\_row\_per\_block
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "0"},{"label": "在按序读取期间，每读取一个块后就发出一条虚拟行，以便 `MergingSortedTransform` 更频繁地重新调整各源的优先级。"}]}]} />

当与 `read_in_order_use_virtual_row` 一起启用时，每读取一个块后都会发出一条虚拟行 (而不仅仅是在每个 parts 的开头) 。
这使 `MergingSortedTransform` 能更频繁地重新调整各源的优先级，这在下游过滤器丢弃大量行、且数据在各个 parts 之间分布不均时尤其有用。
请注意，这会禁用读取时的 `read_in_order_use_buffering` 优化和预合并 (`read_in_order_two_level_merge_threshold`) 。
