Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

ClickHouse 24 min read How-to mediumAdept

Getting started with ClickHouse? 13 mistakes and how to avoid them

ClickHouse's most common beginner mistakes mostly come from misunderstanding parts and merges. A high-cardinality partition key (keep it under 1,000 values), many small inserts, and too many materialized views all lead to "Too many parts" errors. The fixes are to batch 10,000 to 100,000 rows per insert or use async inserts with wait_for_async_insert=1, and to scale vertically before adding nodes. Other guidance covers classic ALTER mutations versus lightweight updates via patch parts (up to 1,000× faster), deduplication with ReplacingMergeTree and FINAL, lightweight deletes, the native JSON type versus explicit columns, avoiding Nullable, and insert-time deduplication.

Related posts

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

    ClickHouse mediumAdept

    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.

  • ClickHouse Release 26.1

    ClickHouse mediumAdept

    ClickHouse 26.1 ships 25 new features, 43 performance optimizations and 176 bug fixes. The headline change makes deduplication of asynchronous inserts work end to end with dependent materialized views. Per-insert dedup hashes are carried through each flushed batch and checked independently against Keeper state for the base table and each view target, so retries no longer double-count transformed data. The release also adds shorthand syntax for indexing projections (PROJECTION ... INDEX col TYPE basic), DISTINCT on LowCardinality columns that operates on the dictionary, and new introspection tools: system.zookeeper_info, a Keeper web UI and HTTP API, a files column in system.parts, and the mergeTreeAnalyzeIndexes table function showing the row ranges that survive index pruning.

  • Top 10 best practices tips for ClickHouse

    ClickHouse mediumAdept

    Ten practices for getting performance and storage efficiency out of ClickHouse, each measured on a 150M-row Amazon reviews dataset. Aligning ORDER BY with query filters (low-cardinality columns first) made one query 3x faster and cut scanned data 347x. Right-sized types, no Nullable and LowCardinality(String) doubled query speed and shrank storage. Partitioning is best avoided except for TTL expiry or FINAL on merge engines; monthly partitions slowed one aggregation 46x. The post also covers lightweight versus heavyweight skipping indexes, JSON type hints (38% less storage, 26% faster), and preferring Parquet/ORC for bulk ingestion.

  • ClickHouse 22.2 Released

    ClickHouse mediumAdept

    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. Other additions include settings for append, truncate or new-file behavior when exporting to file/S3/HDFS (Parquet and S3 can't append), custom insert deduplication tokens for exactly-once inserts, EPHEMERAL columns that feed DEFAULT/MATERIALIZED expressions, and automatic repair of broken disks from replicas without a restart. An experimental soft/hard memory limit scheme lets queries exceed a guaranteed limit when memory is free, and kills the most overcommitted query under pressure.

  • Essential Monitoring Queries - part 1 - INSERT Queries

    ClickHouse mediumAdept

    ClickHouse system tables such as part_log, query_log, asynchronous_insert_log, asynchronous_metric_log and parts can be queried with SQL to monitor and troubleshoot INSERT workloads. Ready-to-use queries cover new part creation rate, bulk insert counts versus rows written, insert duration percentiles, per-insert memory and CPU, MaxPartCountForPartition, parts per partition, and part-level errors. Comparing insert request counts to rows written, or watching part counts climb, gives early warning of small-insert patterns and high-cardinality partition keys that lead to 'Too many parts' errors. Duration and resource metrics are only accurate for synchronous inserts, not async_insert or the Buffer engine, and alerting on these queries through tools like Grafana is recommended.

The quest for software engineering knowledge.

Look:
Layout: