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

# default_* 会话设置

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

<div id="default_materialized_view_sql_security">
  ## default\_materialized\_view\_sql\_security
</div>

<SettingsInfoBlock type="SQLSecurityType" default_value="DEFINER" />

允许在创建 materialized view 时为 SQL SECURITY 选项设置默认值。[更多有关 SQL SECURITY 的信息](/zh/reference/statements/create/view#sql_security)。

默认值为 `DEFINER`。

<div id="default_max_bytes_in_join">
  ## default\_max\_bytes\_in\_join
</div>

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

当需要此限制但未设置 `max_bytes_in_join` 时，右侧表的最大大小。

<div id="default_normal_view_sql_security">
  ## default\_normal\_view\_sql\_security
</div>

<SettingsInfoBlock type="SQLSecurityType" default_value="INVOKER" />

允许在创建普通视图时设置默认的 `SQL SECURITY` 选项。[了解更多 SQL security](/zh/reference/statements/create/view#sql_security)。

默认值为 `INVOKER`。

<div id="default_table_engine">
  ## default\_table\_engine
</div>

<SettingsInfoBlock type="DefaultTableEngine" default_value="MergeTree" />

在 `CREATE` 语句中未设置 `ENGINE` 时使用的默认表引擎。

可能的值：

* 表示任意有效表引擎名称的字符串

Cloud 默认值：`SharedMergeTree`。

**示例**

查询：

```sql theme={null}
SET default_table_engine = 'Log';

SELECT name, value, changed FROM system.settings WHERE name = 'default_table_engine';
```

结果：

```response theme={null}
┌─name─────────────────┬─value─┬─changed─┐
│ default_table_engine │ Log   │       1 │
└──────────────────────┴───────┴─────────┘
```

在本示例中，任何未指定 `Engine` 的新表都会使用 `Log` 表引擎：

查询：

```sql theme={null}
CREATE TABLE my_table (
    x UInt32,
    y UInt32
);

SHOW CREATE TABLE my_table;
```

结果：

```response theme={null}
┌─statement────────────────────────────────────────────────────────────────┐
│ CREATE TABLE default.my_table
(
    `x` UInt32,
    `y` UInt32
)
ENGINE = Log
└──────────────────────────────────────────────────────────────────────────┘
```

<div id="default_temporary_table_engine">
  ## default\_temporary\_table\_engine
</div>

<SettingsInfoBlock type="DefaultTableEngine" default_value="Memory" />

与 [default\_table\_engine](/zh/reference/settings/session-settings/default#default_table_engine) 相同，只是适用于临时表。

在此示例中，任何未指定 `Engine` 的新临时表都将使用 `Log` 表引擎：

查询：

```sql theme={null}
SET default_temporary_table_engine = 'Log';

CREATE TEMPORARY TABLE my_table (
    x UInt32,
    y UInt32
);

SHOW CREATE TEMPORARY TABLE my_table;
```

结果：

```response theme={null}
┌─statement────────────────────────────────────────────────────────────────┐
│ CREATE TEMPORARY TABLE default.my_table
(
    `x` UInt32,
    `y` UInt32
)
ENGINE = Log
└──────────────────────────────────────────────────────────────────────────┘
```

<div id="default_view_definer">
  ## default\_view\_definer
</div>

<SettingsInfoBlock type="String" default_value="CURRENT_USER" />

可在创建视图时设置默认的 `DEFINER` 选项。[关于 SQL security 的更多信息](/zh/reference/statements/create/view#sql_security)。

默认值为 `CURRENT_USER`。
