ClickHouse Cloud Unleashes Compiled UDFs for AI
Alps Wang
Oct 5, 2026 · 6 views
Bridging Code and Data with Executable UDFs
The general availability of executable UDFs on ClickHouse Cloud marks a substantial leap in its data processing capabilities, particularly for AI and data-intensive workloads. The introduction of a native runtime supporting Rust, Go, C++, and JavaScript (via Bun) is a game-changer, moving beyond Python's limitations and enabling developers to leverage their preferred compiled languages for maximum performance and efficiency. This directly addresses a key pain point identified during the beta: the desire for compiled code execution. The addition of network access, per-process memory limits, and a deterministic flag are crucial for real-world applications, allowing for more complex UDFs, better resource management, and enabling query caching for improved performance. The integration with Cloud API and Terraform further solidifies its enterprise readiness, making deployment and management seamless. The ability to monitor UDF performance via system.query_log is invaluable for debugging and optimization.
The practical demonstration of counting LLM tokens and pricing AI model usage within ClickHouse is highly relevant and showcases the immediate value proposition. By bringing the token counting libraries directly to the data, ClickHouse circumvents the traditional ETL pipeline bottlenecks, offering a more efficient and up-to-date approach to cost attribution and analysis. This is particularly important in the rapidly evolving LLM landscape where usage data, especially for streamed responses, can be inconsistent or missing. The flexibility to use UDFs for tasks like grading LLM completions, as shown with the judge_response function, opens up new avenues for data quality assurance and performance evaluation directly within the database.
However, a few considerations remain. While the native runtime is a significant improvement, the requirement for statically linked binaries and the absence of a direct package manager integration might still pose a hurdle for some developers. Ensuring robust security measures for UDFs, especially those with network access, will be paramount as adoption grows. Furthermore, while the article mentions UDFs consume existing resources and are not billed separately, clear guidelines on resource consumption and potential impact on query performance for heavily utilized UDFs would be beneficial for capacity planning. The reliance on specific compilation targets (amd64, arm64) also adds a layer of complexity to the build process. Despite these points, the overall impact of this release is overwhelmingly positive, democratizing advanced data processing within ClickHouse.
Key Points
- ClickHouse Cloud now offers General Availability for Executable UDFs, supporting compiled code in Rust, Go, C++, and JavaScript (via Bun) alongside Python.
- New features include network access for UDFs, per-process memory limits, and a deterministic flag to enable query caching.
- Enhanced observability with per-query UDF metrics in system.query_log and support for Cloud API/Terraform for easier management.
- Demonstrated practical use cases include counting LLM tokens and estimating AI model costs directly within ClickHouse, bypassing traditional ETL.
- Native runtime requires statically linked binaries, with support for both amd64 and arm64 architectures.

📖 Source: Executable UDFs are now generally available on ClickHouse Cloud
Related Articles
Comments (0)
No comments yet. Be the first to comment!
