---
title: "AI doesn’t always generate perfect ClickHouse schemas (yet)"
description: "LLM-generated ClickHouse schemas tend to over-optimize from day one with custom partitioning, per-column codecs, projections and materialized views that can hurt at production scale."
url: "https://swe.quest/articles/ai-doesn-t-always-generate-perfect-clickhouse-schemas-yet-fd8dcf025b9d0fa8"
canonical: "https://clickhouse.com/blog/ai-generated-clickhouse-schemas-mistakes-and-advice"
source: "ClickHouse"
published: "2026-03-13"
difficulty: "medium"
kind: "Opinion"
reading_minutes: 10
tags: ["analytics","databases","llms","performance"]
---

# AI doesn’t always generate perfect ClickHouse schemas (yet)

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2026-03-13, 10 min read, Opinion. Original: [https://clickhouse.com/blog/ai-generated-clickhouse-schemas-mistakes-and-advice](https://clickhouse.com/blog/ai-generated-clickhouse-schemas-mistakes-and-advice)

## Summary

LLM-generated ClickHouse schemas tend to over-optimize from day one with custom partitioning, per-column codecs, projections and materialized views that can hurt at production scale. Five recurring pitfalls are covered: partitioning for query speed instead of data lifecycle, OPTIMIZE TABLE ... FINAL creating irreversible oversized parts that break later mutations, materialized view sprawl slowing ingestion, JSON columns misconfigured via max\_dynamic\_paths, and projections adding 1-2 seconds of planning latency at 5-10+ TB. The recommendation is to start with a plain MergeTree, a well-chosen ORDER BY, default compression and nothing else, then measure the real workload and add complexity only where data justifies it.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)
- [Databases](https://swe.quest/tags/databases.md) (Data & databases)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)

## Prerequisites

- ClickHouse MergeTree basics ([easy posts on Analytics & OLAP](https://swe.quest/tags/analytics.md?difficulty=easy))
- columnar database concepts ([easy posts on Databases](https://swe.quest/tags/databases.md?difficulty=easy))

## Keywords

ClickHouse, ReplacingMergeTree, OPTIMIZE TABLE FINAL, materialized views, projections, max\_dynamic\_paths

## Related posts

- [Top 10 best practices tips for ClickHouse](https://swe.quest/articles/top-10-best-practices-tips-for-clickhouse-4df5699bf7bd75dd.md): ClickHouse · 2026-03-26 · Medium · 21 min read · Analytics & OLAP, Performance engineering, Databases, SQL
  Ten practices for getting performance and storage efficiency out of ClickHouse, each measured on a 150M-row Amazon reviews dataset.
- [Getting started with ClickHouse? 13 mistakes and how to avoid them](https://swe.quest/articles/getting-started-with-clickhouse-13-mistakes-and-how-to-avoid-them-0a59569ca1b71a22.md): ClickHouse · 2026-02-20 · Medium · 24 min read · Analytics & OLAP, Databases, Storage engines, Performance engineering
  ClickHouse's most common beginner mistakes mostly come from misunderstanding parts and merges.
- [Optimizing ClickHouse with Schemas and Codecs](https://swe.quest/articles/optimizing-clickhouse-with-schemas-and-codecs-795411feff5942b1.md): ClickHouse · 2022-12-14 · Medium · 23 min read · Analytics & OLAP, Storage engines, Performance engineering, SQL
  Tightening a ClickHouse schema with strict types cuts a 1B-row NOAA weather dataset from 131.58 GiB to 71.38 GiB uncompressed.
- [Building a product analytics solution with ClickHouse](https://swe.quest/articles/building-a-product-analytics-solution-with-clickhouse-786424348993d92f.md): ClickHouse · 2024-12-05 · Medium · 24 min read · Analytics & OLAP, SQL, Databases, Product engineering
  ClickHouse's in-house product analytics platform, Galaxy, stores over 20 billion events (14 TB, roughly 14x compression) in a single denormalized MergeTree table keyed on created\_at.
- [ClickHouse 22.2 Released](https://swe.quest/articles/clickhouse-22-2-released-cb382bb271f76cf3.md): ClickHouse · 2022-02-24 · Medium · 5 min read · Analytics & OLAP, Databases, Replication
  ClickHouse 22.2 makes projections production-ready: alternate sort orders and aggregations stored in the same data parts, updated atomically with the main table and chosen automatically by the query optimizer, unlike materialized views.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
