这些设置可在 system.settings 中查看,并由 源代码 自动生成。
optimize_rewrite_aggregate_function_with_if
类型
Bool
默认值
1
当逻辑上等价时,将以 if 表达式作为参数的聚合函数重写为等效形式。
例如,avg(if(cond, col, null)) 可以重写为 avgOrNullIf(cond, col)。这可能会提升性能。
optimize_rewrite_array_exists_to_has
类型
Bool
默认值
1
版本历史
| 版本 | 默认值 | 注释 |
|---|---|---|
| 26.4 | 1 | 默认启用将 arrayExists 重写为 has 的优化,因为现在会在重写前检查类型兼容性。 |
当逻辑上等价时,将 arrayExists() 函数重写为 has()。例如,arrayExists(x -> x = 1, arr) 可重写为 has(arr, 1)
optimize_rewrite_has_to_in
类型
Bool
默认值
1
版本历史
| 版本 | 默认值 | 注释 |
|---|---|---|
| 26.6 | 1 | 新增设置 |
当第一个参数为常量数组时,将 has 函数重写为 IN。例如,has([1, 2, 3], x) 可重写为 x IN [1, 2, 3],从而在处理常量数组时获得更好的性能
optimize_rewrite_like_perfect_affix
类型
Bool
默认值
1
版本历史
| 版本 | 默认值 | 注释 |
|---|---|---|
| 25.10 | 1 | 新增设置 |
将具有精确前缀或后缀的 LIKE 表达式 (例如 col LIKE 'ClickHouse%') 重写为 startsWith 或 endsWith 函数 (例如 startsWith(col, 'ClickHouse')) 。
optimize_rewrite_regexp_functions
类型
Bool
默认值
1
版本历史
| 版本 | 默认值 | 注释 |
|---|---|---|
| 25.8 | 1 | 新增设置 |
将与正则表达式相关的函数重写为更简单、更高效的形式
optimize_rewrite_sum_if_to_count_if
类型
Bool
默认值
1
版本历史
| 版本 | 默认值 | 注释 |
|---|---|---|
| 24.4 | 1 | 仅 analyzer 可用,且仅在该组件中能正确工作 |
当逻辑上等价时,将 sumIf() 和 sum(if()) 函数重写为 countIf() 函数