clickhouse

Guides ClickHouse OLAP insert, query, and schema patterns from Rust and Node.js.

2|Updated May 16, 2026
One-click install
npx skills add https://github.com/avbel/ai-skills --skill clickhouse-avbel
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: clickhouse
Source: https://github.com/avbel/ai-skills/tree/main/skills/clickhouse
Command: npx skills add https://github.com/avbel/ai-skills --skill clickhouse-avbel

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? ClickHouse behaves very differently from OLTP databases, and developers routinely hit merge storms, "too many parts" errors, and slow queries by applying transactional-database habits. This Skill encodes the conventions for using ClickHouse correctly from Rust and Node.js so agents generate idiomatic ingestion and analytics code. ## Core Features & Use Cases - Client library guidance: Covers the Rust clickhouse crate (typed Row structs, buffered inserts, RowBinary) and the official @clickhouse/client for Node.js, including the browser/edge build. - Insert and query patterns: Large batch inserts, async inserts, ReplacingMergeTree deduplication, materialized-view rollups, TTL retention, and ORDER BY/skip-index design. - Antipattern catalog: A table of common mistakes (per-row inserts, heavy mutations, FINAL everywhere, over-partitioning) with the correct alternative for each. - Use Case: When building an event-ingestion pipeline that writes millions of rows per day, use this Skill to generate batched insert code with async_insert settings and a ReplacingMergeTree table instead of row-by-row writes. ## Quick Start Ask the agent to write a Rust or Node.js function that batch-inserts events into a ClickHouse table following ClickHouse best practices.

Frequently Asked Questions about clickhouse

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I batch insert rows into ClickHouse from Node.js?▼

Use @clickhouse/client with client.insert({ table, values, format: 'JSONEachRow' }) passing a large array of objects per call. Aim for tens of thousands of rows per insert, or enable async_insert=1 so the server batches many small producers for you.

Which Rust crate should I use for ClickHouse?▼

Use the clickhouse crate, the recommended async HTTP client with typed Row derives and buffered insert APIs. The older clickhouse-rs TCP crate still exists, but the HTTP crate is preferred for new code and ClickHouse Cloud compatibility.

Why does ClickHouse throw 'too many parts' errors?▼

The error comes from many small frequent inserts creating thousands of tiny parts that background merges cannot keep up with. Fix it by batching inserts into large blocks or enabling async_insert so the server merges small inserts server-side.

Can ClickHouse handle updates and deletes like PostgreSQL?▼

ClickHouse is append-mostly and not suited for OLTP-style mutations. Use lightweight DELETE sparingly, model updates with ReplacingMergeTree or CollapsingMergeTree, and avoid ALTER TABLE UPDATE mutations which rewrite entire parts.

How do I deduplicate rows in ClickHouse?▼

Use a ReplacingMergeTree table with a version column and apply FINAL or GROUP BY with argMax(ver) at query time. Deduplication happens eventually during background merges, so never assume duplicates are gone immediately after insert.