Skip to content
ClickHouse Docs
ClickHouse DocsClickHouse Docs

short_circuit_function_evaluation_* session settings

These settings are available in system.settings and are autogenerated from source.

short_circuit_function_evaluation

Type
ShortCircuitFunctionEvaluation
Default
enable

Allows calculating the if, multiIf, and, and or functions according to a short scheme. This helps optimize the execution of complex expressions in these functions and prevent possible exceptions (such as division by zero when it is not expected).

Possible values:

  • enable — Enables short-circuit function evaluation for functions that are suitable for it (can throw an exception or computationally heavy).
  • force_enable — Enables short-circuit function evaluation for all functions.
  • disable — Disables short-circuit function evaluation.

short_circuit_function_evaluation_for_nulls

Type
Bool
Default
1
Version history
VersionDefault valueComment
25.11Allow to execute functions with Nullable arguments only on rows with non-NULL values in all arguments

Optimizes evaluation of functions that return NULL when any argument is NULL. When the percentage of NULL values in the function’s arguments exceeds the short_circuit_function_evaluation_for_nulls_threshold, the system skips evaluating the function row-by-row. Instead, it immediately returns NULL for all rows, avoiding unnecessary computation.

short_circuit_function_evaluation_for_nulls_threshold

Type
Double
Default
1
Version history
VersionDefault valueComment
25.11Ratio threshold of NULL values to execute functions with Nullable arguments only on rows with non-NULL values in all arguments. Applies when setting short_circuit_function_evaluation_for_nulls is enabled.

Ratio threshold of NULL values to execute functions with Nullable arguments only on rows with non-NULL values in all arguments. Applies when setting short_circuit_function_evaluation_for_nulls is enabled. When the ratio of rows containing NULL values to the total number of rows exceeds this threshold, these rows containing NULL values will not be evaluated.

Navigation