v.21.9New Feature

Implementation of Short Circuit Function Evaluation with New Configuration Setting

Implementation of short circuit function evaluation, closes #12587. Add settings short_circuit_function_evaluation to configure short circuit function evaluation. #23367 (Kruglov Pavel).
Implemented short circuit function evaluation in ClickHouse, allowing functions to stop evaluating further arguments once the result is determined.

Why it matters

This feature improves query performance and efficiency by avoiding unnecessary computation in function evaluation. It solves the problem of evaluating all function arguments even when the result could be determined early (e.g., logical AND/OR functions), reducing CPU usage and speeding up query execution.

How to use it

Enable short circuit function evaluation by setting the short_circuit_function_evaluation setting to true. This setting can be applied in the user profile, session, or query level to control behavior.