Skip to content
ClickHouse Docs

short_circuit_function_evaluation_* session settings

Autogenerated from ClickHouse system tables

These settings are available in system.settings and are autogenerated from the ClickHouse snapshot.

short_circuit_function_evaluation

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

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.

This setting controls an optimization only. Functions that cannot be executed on the default value of their arguments - such as parseDateTime, IPv4StringToNum or intDiv - always skip the rows containing a NULL regardless of this setting, because the value stored behind a NULL is the default value of the argument type and executing on it would throw on otherwise valid data.

short_circuit_function_evaluation_for_nulls_threshold

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.