v.20.4Improvement

Use isInjective() for GROUP BY Optimization

Use isInjective() over manual list of such functions for GROUP BY optimization. #10342 (Azat Khuzhin)
Introduced the use of the isInjective() function to automatically identify injective functions for GROUP BY optimization instead of relying on a manual list.

Why it matters

This feature aims to improve the efficiency and maintainability of GROUP BY query optimizations by dynamically detecting injective functions. It replaces the previous manual specification of such functions, reducing errors and enabling more accurate optimization, which can lead to better query performance.

How to use it

Users do not need to manually configure anything. ClickHouse now internally uses the isInjective() function during query optimization for GROUP BY clauses to automatically detect injective functions and apply related optimizations.