<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-we-built-an-ai-agent-you-can-trust-with-your-production-tables-b5g56yzsc" -->

---
title: How we built an AI agent you can trust with your...
description: ClickHouse Cloud's Schema Advisor, now in Private Preview, splits the work so the LLM only plans schema changes and never touches production. Recommendations...
canonical: https://daily.dev/posts/how-we-built-an-ai-agent-you-can-trust-with-your-production-tables-b5g56yzsc
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How we built an AI agent you can trust with your production tables | daily.dev
og:description: ClickHouse Cloud's Schema Advisor, now in Private Preview, splits the work so the LLM only plans schema changes and never touches production. Recommendations...
og:url: https://daily.dev/posts/how-we-built-an-ai-agent-you-can-trust-with-your-production-tables-b5g56yzsc
og:image: https://api.daily.dev/og/posts/B5G56YzSc.png
og:image:alt: How we built an AI agent you can trust with your production tables
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How we built an AI agent you can trust with your production tables

**[ClickHouse](https://daily.dev/sources/clickhouse)** · 8 min read · 0 upvotes · 0 comments

## Summary

ClickHouse Cloud's Schema Advisor, now in Private Preview, splits the work so the LLM only plans schema changes and never touches production. Recommendations come from deterministic tests on your query logs, not from AI. The LLM writes a plan with exact SQL for each step. Impact analysis replays your most frequent queries against a sampled baseline table and a candidate table, comparing query time, rows scanned and data read. Temporal runs the workflow, and templated SQL like EXCHANGE TABLES runs only after you approve the exact statement. Full table rebuilds are not yet supported on large or continuously ingested tables, or on tables with materialized views.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://clickhouse.com/blog/how-we-built-an-ai-agent-you-can-trust-with-your-production-tables>

## Questions this post answers

### How does ClickHouse Schema Advisor keep an AI agent from running harmful SQL on production tables?

Schema Advisor lets the LLM only produce a plan with exact SQL for each step. A Temporal workflow executes it, and production-affecting statements like EXCHANGE TABLES or DROP TABLE are templated SQL run by the workflow, never the LLM. They run only after you approve the exact statement shown, including cleanup of the old table.

_Teams weighing AI in database operations follow safety patterns like this on daily.dev._

### How do I change the ORDER BY or primary key of a ClickHouse table without downtime?

For a full table rebuild, Schema Advisor creates a new table, migrates the data, audits it to validate, then runs EXCHANGE TABLES with the production table so there is zero downtime. The old table is kept as a backup. Index and projection changes use a direct ALTER statement instead, applied after you approve it.

_Engineers planning ClickHouse schema migrations compare approaches like this on daily.dev._

### How does ClickHouse Schema Advisor test whether a schema change actually improves performance?

It samples your table as a baseline (current schema) and builds a candidate table (new schema) from that sample. It then replays the queries that run most often on your table against both and compares query time, rows scanned, and data read, averaged across the queries. This can run in your service or an isolated sandbox.

_Developers validating database optimizations before shipping follow this kind of workflow on daily.dev._

## Similar posts on daily.dev

- [Hybrid AI: Combining Deterministic Analytics with LLM Reasoning](https://daily.dev/posts/hybrid-ai-combining-deterministic-analytics-with-llm-reasoning-gtx99tbc2) · Towards Data Science · 2 upvotes · 0 comments
- [AlloyDB Ships Proxy Models That Replace LLM Calls with Local Inference Inside the Database](https://daily.dev/posts/alloydb-ships-proxy-models-that-replace-llm-calls-with-local-inference-inside-the-database-4vvzzcrji) · InfoQ · 1 upvotes · 0 comments
- [The evolution of agentic AI and text-to-SQL](https://daily.dev/posts/the-evolution-of-agentic-ai-and-text-to-sql-95le3ea3l) · Red Hat Developer · 0 upvotes · 0 comments
- [LLMs Are Good at SQL. We Gave Ours Terabytes of CI Logs.](https://daily.dev/posts/llms-are-good-at-sql-we-gave-ours-terabytes-of-ci-logs--lvk4qon8b) · Hacker News · 1 upvotes · 0 comments

---

Tags: [#ai-agents](https://daily.dev/tags/ai-agents), [#clickhouse](https://daily.dev/tags/clickhouse), [#amazon-bedrock](https://daily.dev/tags/amazon-bedrock)

[View this post on daily.dev](https://daily.dev/posts/how-we-built-an-ai-agent-you-can-trust-with-your-production-tables-b5g56yzsc)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How we built an AI agent you can trust with your production tables","url":"https://daily.dev/posts/how-we-built-an-ai-agent-you-can-trust-with-your-production-tables-b5g56yzsc","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-we-built-an-ai-agent-you-can-trust-with-your-production-tables-b5g56yzsc"},"datePublished":"2026-12-01T00:03:47.563Z","dateModified":"2026-12-01T00:04:11.332Z","description":"ClickHouse Cloud's Schema Advisor, now in Private Preview, splits the work so the LLM only plans schema changes and never touches production. Recommendations...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/f3180a75f2fc37e460dcbb936ac5e853?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/f3180a75f2fc37e460dcbb936ac5e853?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"ClickHouse","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"ClickHouse","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/clickhouse","url":"https://daily.dev/sources/clickhouse"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-we-built-an-ai-agent-you-can-trust-with-your-production-tables-b5g56yzsc","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"ai-agents,clickhouse,amazon-bedrock","timeRequired":"PT8M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"ClickHouse","item":"https://daily.dev/sources/clickhouse"},{"@type":"ListItem","position":3,"name":"How we built an AI agent you can trust with your production tables"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/how-we-built-an-ai-agent-you-can-trust-with-your-production-tables-b5g56yzsc#faq","mainEntity":[{"@type":"Question","name":"How does ClickHouse Schema Advisor keep an AI agent from running harmful SQL on production tables?","acceptedAnswer":{"@type":"Answer","text":"Schema Advisor lets the LLM only produce a plan with exact SQL for each step. A Temporal workflow executes it, and production-affecting statements like EXCHANGE TABLES or DROP TABLE are templated SQL run by the workflow, never the LLM. They run only after you approve the exact statement shown, including cleanup of the old table. Teams weighing AI in database operations follow safety patterns like this on daily.dev."}},{"@type":"Question","name":"How do I change the ORDER BY or primary key of a ClickHouse table without downtime?","acceptedAnswer":{"@type":"Answer","text":"For a full table rebuild, Schema Advisor creates a new table, migrates the data, audits it to validate, then runs EXCHANGE TABLES with the production table so there is zero downtime. The old table is kept as a backup. Index and projection changes use a direct ALTER statement instead, applied after you approve it. Engineers planning ClickHouse schema migrations compare approaches like this on daily.dev."}},{"@type":"Question","name":"How does ClickHouse Schema Advisor test whether a schema change actually improves performance?","acceptedAnswer":{"@type":"Answer","text":"It samples your table as a baseline (current schema) and builds a candidate table (new schema) from that sample. It then replays the queries that run most often on your table against both and compares query time, rows scanned, and data read, averaged across the queries. This can run in your service or an isolated sandbox. Developers validating database optimizations before shipping follow this kind of workflow on daily.dev."}}]}
```

