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

# function_* 会话设置

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

<div id="function_base58_max_input_size">
  ## function\_base58\_max\_input\_size
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "10000"},{"label": "默认情况下，这项新设置会将 `base58Encode`、`base58Decode` 和 `tryBase58Decode` 的输入大小限制为 10 KB（其转换复杂度随输入长度呈二次增长）。兼容性值 `0` 会禁用此限制，恢复此前可接受任意大小输入的行为。"}]}]} />

函数 `base58Encode`、`base58Decode` 和 `tryBase58Decode` 的单个输入值最大大小，以字节为单位。通用的 `base58` 转换复杂度随输入长度呈二次增长，因此单个较大的值可能会运行很长时间。`base58` 适用于短数据 (密钥、哈希、地址) ，因此默认的 10 KB 是一个较为宽松的安全阈值。对于更大的输入，`base58Encode` 和 `base58Decode` 会抛出 `TOO_LARGE_STRING_SIZE`，而 `tryBase58Decode` 会返回空字符串。值 `0` 会禁用此限制 (即引入此设置之前的行为) 。线性的 `base32` 和 `base64` 函数不受影响。

<div id="function_date_trunc_return_type_behavior">
  ## function\_date\_trunc\_return\_type\_behavior
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.7"},{"label": "0"},{"label": "新增设置，以保留 dateTrunc 函数的旧行为"}]}, {"id": "row-2","items": [{"label": "25.4"},{"label": "0"},{"label": "将 dateTrunc 函数在 DateTime64\/Date32 参数下的结果类型更改为始终返回 DateTime64\/Date32，而不受时间单位影响，以确保负值结果正确"}]}]} />

允许更改 `dateTrunc` 函数返回结果类型的行为。

可能的值：

* 0 - 当第二个参数为 `DateTime64/Date32` 时，返回类型将始终为 `DateTime64/Date32`，与第一个参数中的时间单位无关。
* 1 - 对于 `Date32`，结果始终为 `Date`。对于 `DateTime64`，当时间单位为 `second` 及以上时，结果为 `DateTime`。

<div id="function_implementation">
  ## function\_implementation
</div>

为特定目标或变体选择函数实现方式 (Experimental) 。如果留空，则启用所有实现。

<div id="function_locate_has_mysql_compatible_argument_order">
  ## function\_locate\_has\_mysql\_compatible\_argument\_order
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "1"},{"label": "增强与 MySQL 的 locate 函数的兼容性。"}]}]} />

控制函数 [locate](/docs/zh/reference/functions/regular-functions/string-search-functions#locate) 的参数顺序。

可能的值：

* 0 — 函数 `locate` 接受参数 `(haystack, needle[, start_pos])`。
* 1 — 函数 `locate` 接受参数 `(needle, haystack, [, start_pos])` (兼容 MySQL 的行为)

<div id="function_range_max_elements_in_block">
  ## function\_range\_max\_elements\_in\_block
</div>

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

设置函数 [range](/docs/zh/reference/functions/regular-functions/array-functions#range) 生成数据量的安全阈值。定义该函数每个数据块可生成的最大值数量 (即一个块中每一行数组大小的总和) 。

可能的值：

* 正整数。

**另请参见**

* [`max_block_size`](/docs/zh/reference/settings/session-settings/max#max_block_size)
* [`min_insert_block_size_rows`](/docs/zh/reference/settings/session-settings/min-insert#min_insert_block_size_rows)

<div id="function_sleep_max_microseconds_per_block">
  ## function\_sleep\_max\_microseconds\_per\_block
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.7"},{"label": "3000000"},{"label": "在之前的版本中，3 秒的最大休眠时间仅适用于 `sleep`，不适用于 `sleepEachRow` 函数。在新版本中，我们引入了这一设置。如果将 compatibility 设置为旧版本，则会完全禁用该限制。"}]}]} />

函数 `sleep` 在每个块中允许休眠的最大微秒数。如果用户调用时传入更大的值，就会抛出异常。这是一个安全阈值。

<div id="function_visible_width_behavior">
  ## function\_visible\_width\_behavior
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.1"},{"label": "1"},{"label": "我们将 `visibleWidth` 的默认行为调整得更精确"}]}]} />

`visibleWidth` 行为的版本。0 - 仅统计码点数量；1 - 正确统计零宽字符和组合字符，将全角字符按两个字符计数，估算制表符宽度，并统计删除字符。
