ClickHouse now allows user-defined functions (UDFs) to be marked as deterministic through a new configuration setting. The query cache system has been enhanced to verify the determinism of UDFs within queries and cache results accordingly.
Why it matters
This feature addresses the problem of safely caching query results involving UDFs by ensuring that only queries with deterministic UDFs are cached. It improves query performance by enabling caching for a broader set of queries while maintaining correctness.How to use it
Users can mark a UDF as deterministic by setting the appropriate flag in the UDF configuration. Once marked, queries calling these deterministic UDFs will have their results cached automatically by the query cache system, enhancing performance without additional user intervention.