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

# enable_optimize_predicate_expression_* 会话设置

> ClickHouse 中属于 enable_optimize_predicate_expression_* 生成组的会话设置。

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="enable_optimize_predicate_expression">
  ## enable\_optimize\_predicate\_expression
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "18.12.17"},{"label": "1"},{"label": "默认对子查询进行谓词下推优化"}]}]} />

在 `SELECT` 查询中启用谓词下推。

谓词下推可显著减少分布式查询的网络流量。

可能的值：

* 0 — 已禁用。
* 1 — 已启用。

用法

考虑以下查询：

1. `SELECT count() FROM test_table WHERE date = '2018-10-10'`
2. `SELECT count() FROM (SELECT * FROM test_table) WHERE date = '2018-10-10'`

如果 `enable_optimize_predicate_expression = 1`，这两个查询的执行时间是相同的，因为 ClickHouse 在处理子查询时会将 `WHERE` 条件下推到子查询中。

如果 `enable_optimize_predicate_expression = 0`，第二个查询的执行时间会长得多，因为只有在子查询完成后，`WHERE` 子句才会应用于全部数据。

<div id="enable_optimize_predicate_expression_to_final_subquery">
  ## enable\_optimize\_predicate\_expression\_to\_final\_subquery
</div>

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

允许将谓词下推到 FINAL 子查询。
