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

# mysql_* 会话设置

> ClickHouse 在 mysql_* 生成的组中的会话设置。

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="mysql_datatypes_support_level">
  ## mysql\_datatypes\_support\_level
</div>

<SettingsInfoBlock type="MySQLDataTypesSupport" default_value="decimal,datetime64,date2Date32,geometry" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.7"},{"label": "decimal,datetime64,date2Date32,geometry"},{"label": "默认将 MySQL 的具体空间类型（LINESTRING、POLYGON、MULTILINESTRING、MULTIPOLYGON、MULTIPOINT）以及通用的 GEOMETRY 类型映射为对应的 ClickHouse 几何类型。通用的 GEOMETRY 列会映射到总括类型 Geometry；如果读取到某个子类型在 ClickHouse 中没有对应类型的值（GEOMETRYCOLLECTION），会在读取时抛出异常。"}]}, {"id": "row-2","items": [{"label": "26.3"},{"label": "decimal,datetime64,date2Date32"},{"label": "默认启用现代 MySQL 类型映射。"}]}]} />

定义如何将 MySQL 类型转换为对应的 ClickHouse 类型。它是一个由逗号分隔的列表，可以是 `decimal`、`datetime64`、`date2Date32`、`date2String` 或 `geometry` 的任意组合。默认启用所有现代映射 (`decimal`、`datetime64`、`date2Date32`、`geometry`) 。

* `decimal`：在精度允许的情况下，将 `NUMERIC` 和 `DECIMAL` 类型转换为 `Decimal`。
* `datetime64`：当精度不为 `0` 时，将 `DATETIME` 和 `TIMESTAMP` 类型转换为 `DateTime64`，而不是 `DateTime`。
* `date2Date32`：将 `DATE` 转换为 `Date32`，而不是 `Date`。其优先次序高于 `date2String`。
* `date2String`：将 `DATE` 转换为 `String`，而不是 `Date`。会被 `datetime64` 覆盖。
* `geometry`：将 MySQL 的空间类型 (`LINESTRING`、`POLYGON`、`MULTILINESTRING`、`MULTIPOLYGON`、`MULTIPOINT`) 转换为对应的 ClickHouse 几何类型，并将通用的 `GEOMETRY` 类型转换为总括类型 `Geometry`。无论是否启用此选项，`POINT` 始终都会转换为 `Point`。由于通用的 `GEOMETRY` 列可以保存任意子类型，如果读取到某个子类型在 ClickHouse 中没有对应类型的值 (`GEOMETRYCOLLECTION`)，会在读取时抛出异常；声明为 `GEOMETRYCOLLECTION` 的列会映射为 `String`。除 `POINT` 外，可为 NULL 的空间列也会映射为 `Nullable(String)`，因为 `Point` 是唯一可嵌套在 `Nullable` 中的几何类型。每个此类字符串均由 4 字节的 SRID 前缀和 MySQL 返回的 WKB 载荷组成。以上内容适用于根据 MySQL 表的列类型推断 schema 的情况；当 source 为查询 (`mysql` 表函数或 `MySQL` 表引擎的 `query(...)` 参数) 时，MySQL 会将每个空间结果列都报告为不含具体子类型的通用 `GEOMETRY`，因此此类列 (包括 `POINT`) 会映射为 `String` (如果可为 NULL，则为 `Nullable(String)`) 。

<div id="mysql_max_rows_to_insert">
  ## mysql\_max\_rows\_to\_insert
</div>

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

MySQL 存储引擎进行 MySQL 批次插入时的最大行数
