DATABASES Signal 149
AI Functions in ClickHouse: Upgrade your SQL to the AI age
ClickHouse 26.8 introduces a beta set of AI Functions that let SQL queries invoke LLMs and embedding models directly.
Running LLM calls inside the database removes the need to extract data to a separate inference service, reducing latency and operational complexity. It also lets you combine AI results with native ClickHouse filters, joins and vector search in a single query.
Written by elseif from the cluster below · every claim links back to a sourceThe three things worth knowing
Functions such as aiClassify, aiGenerate, aiTranslate, aiEmbed, aiFilter, aiRedact and aiSimilarity are available in the 26.8 beta.
Each function makes a remote HTTP call to a configured provider, with credentials stored in named collections and selected via default-credential settings.
In ClickHouse Cloud the functions are plug-and-play, while OSS requires manual creation of named collections and setting of ai_function_* defaults.
THE READ
What the cluster adds up to.
ClickHouse has expanded its SQL engine with a family of built-in AI Functions that call large language models or embedding providers directly from queries. The functions arrived across three releases, culminating in version 26.8 with text-oriented calls (aiClassify, aiGenerate, aiExtract, aiTranslate, aiFilter, aiRedact) and vector-oriented calls (aiEmbed, aiSimilarity). All functions are currently in beta, and they treat the model as another built-in function such as lower() or sum().
To adopt these functions in the open-source edition, engineers must create two named collections that hold provider credentials, then set the ai_function_text_default_credentials and ai_function_embedding_default_credentials settings to point to those collections. The configuration includes provider name, endpoint URL and API key, and can be overridden per call. In ClickHouse Cloud the preview is private and requires no extra configuration, making the feature plug-and-play for cloud users.
The functions operate by issuing an HTTP request to the configured LLM or embedding service for each input row, or batching inputs for embedding calls. This introduces latency proportional to network round-trip time and incurs any usage costs imposed by the external provider. Because the feature is beta, it may lack full stability guarantees and is only available in version 26.8 and later.
By moving the model invocation to the database, the workflow eliminates the traditional extract-transform-load step used in Retrieval-Augmented Generation pipelines. Engineers can now write a single SELECT that classifies, filters, translates or computes similarity without orchestrating separate services, simplifying pipelines and reducing error-prone data movement. However, the reliance on external APIs means that rate limits, authentication failures, or provider outages will directly affect query execution.
AI Functions return native ClickHouse types, allowing their results to be used in WHERE, PREWHERE, JOIN … ON clauses or further analytical processing. Embedding functions support batch processing, which can mitigate per-row overhead for large datasets. The overall impact is a tighter integration of AI capabilities within the database, but adoption requires careful credential management and awareness of external service costs and latency.
Written by elseif from the cluster below · checked for specifics the sources never containedTHE CLUSTER
↗