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

# allow_suspicious_* 会话设置

> ClickHouse 中 allow_suspicious_* 自动生成分组里的会话设置。

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="allow_suspicious_codecs">
  ## allow\_suspicious\_codecs
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "20.5"},{"label": "0"},{"label": "不允许指定无意义的压缩编解码器"}]}]} />

如果将其设为 true，则允许指定无意义的压缩编解码器。

<div id="allow_suspicious_fixed_string_types">
  ## allow\_suspicious\_fixed\_string\_types
</div>

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

在 CREATE TABLE 语句 中，允许创建类型为 FixedString(n) 且 n > 256 的列。长度 >= 256 的 FixedString 很不寻常，通常表明存在误用

<div id="allow_suspicious_indices">
  ## allow\_suspicious\_indices
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.4"},{"label": "0"},{"label": "如果为 true，则可以使用相同的表达式定义索引"}]}]} />

拒绝使用相同表达式的主索引/次级索引和排序键

<div id="allow_suspicious_low_cardinality_types">
  ## allow\_suspicious\_low\_cardinality\_types
</div>

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

允许或限制将 [LowCardinality](/docs/zh/reference/data-types/lowcardinality) 用于固定大小为 8 字节及以下的数据类型：数值数据类型以及 `FixedString(8_bytes_or_less)`。

对于较小的固定值，使用 `LowCardinality` 通常效率不高，因为 ClickHouse 会为每一行存储一个数值索引。因此：

* 磁盘空间占用可能增加。
* RAM 占用可能更高，具体取决于字典大小。
* 某些函数可能会因额外的编码操作而执行更慢。

在 [MergeTree](/docs/zh/reference/engines/table-engines/mergetree-family/mergetree) 引擎表中，基于上述所有原因，合并时间也可能增加。

可能的值：

* 1 — 不限制使用 `LowCardinality`。
* 0 — 限制使用 `LowCardinality`。

<div id="allow_suspicious_primary_key">
  ## allow\_suspicious\_primary\_key
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "0"},{"label": "禁止在 MergeTree 中使用可疑的 PRIMARY KEY\/ORDER BY（即 SimpleAggregateFunction）"}]}]} />

允许在 MergeTree 中使用可疑的 `PRIMARY KEY`/`ORDER BY` (即 SimpleAggregateFunction) 。

<div id="allow_suspicious_ttl_expressions">
  ## allow\_suspicious\_ttl\_expressions
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.12"},{"label": "0"},{"label": "这是一个新增设置；在之前的版本中，其行为等同于允许。"}]}]} />

拒绝不依赖表中任何列的 TTL 表达式。这在大多数情况下都表明是用户误用。

<div id="allow_suspicious_types_in_group_by">
  ## allow\_suspicious\_types\_in\_group\_by
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.11"},{"label": "0"},{"label": "默认不允许在 GROUP BY 中使用 Variant/Dynamic 类型"}]}]} />

控制是否允许在 GROUP BY 键中使用 [Variant](/docs/zh/reference/data-types/variant) 和 [Dynamic](/docs/zh/reference/data-types/dynamic) 类型。

<div id="allow_suspicious_types_in_order_by">
  ## allow\_suspicious\_types\_in\_order\_by
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.11"},{"label": "0"},{"label": "默认不允许在 ORDER BY 中使用 Variant/Dynamic 类型"}]}]} />

允许或限制在 ORDER BY 键中使用 [Variant](/docs/zh/reference/data-types/variant) 和 [Dynamic](/docs/zh/reference/data-types/dynamic) 类型。

<div id="allow_suspicious_variant_types">
  ## allow\_suspicious\_variant\_types
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "0"},{"label": "默认不允许创建包含可疑成员类型的 Variant 类型"}]}]} />

在 CREATE TABLE 语句中，允许指定包含相近成员类型的 Variant 类型 (例如，不同的数值类型或日期类型) 。启用此设置后，在处理这些相近类型的值时可能会引入一定歧义。
