본문으로 건너뛰기
cccskills
무료GitHub에 공개

clickhouse-pro

ClickHouse columnar analytics — schema design, MergeTree tuning, and fast queries — use for OLAP and high-volume event data.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md4.4 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Overview

ClickHouse is a columnar OLAP database built for sub-second analytics over billions of rows. Its speed comes from a storage layout (MergeTree family) and query engine designed for scans and aggregations — which means schema and query patterns differ sharply from row-oriented databases. This skill covers designing for ClickHouse's strengths.

When to use

  • Designing tables (MergeTree, ReplacingMergeTree, AggregatingMergeTree)
  • Choosing ORDER BY / partition keys for time-series or event data
  • Writing aggregation queries (GROUP BY, uniq, quantiles, window functions)
  • Tuning inserts (batches vs trickle), mutations, and background merges
  • Operating clusters: replication, sharding, backups

Core concepts

ORDER BY is the primary index. The ORDER BY key (sorting key) determines data layout on disk and which queries skip granules. Put the most-filtered columns first — typically (tenant_id, event_time, ...) — because ClickHouse prunes using this key. Choose wrong and every query scans everything.

Columnar means wide tables are cheap. Unlike row stores, selecting 5 columns from a 200-column table reads only those 5. Denormalize aggressively — joins are supported but the engine rewards flat, pre-joined event tables.

Inserts: batch, don't trickle. Each insert creates a part; thousands of tiny inserts create thousands of parts and merge storms. Batch to ~1k–100k rows per insert (or use async inserts / a buffer table). Aim for parts in the hundreds, not millions.

Engines encode update semantics. ReplacingMergeTree keeps the latest row per key (deduplication at merge time — queries should still use FINAL or argMax for exactness). AggregatingMergeTree stores partial aggregate states for incremental rollups. SummingMergeTree/CollapsingMergeTree handle specific accounting patterns. Pick the engine that matches how data changes.

Approximation is a feature. uniq(), quantiles(), and sampling (TABLESAMPLE, SAMPLE BY) trade tiny accuracy losses for 10–100x speedups — perfect for dashboards over billions of rows.

Practical workflow

  1. Start from the queries: list the filters and group-bys your dashboards need; these dictate the ORDER BY key and partitioning (usually by month on the timestamp).
  2. Define the table with the right engine, PARTITION BY toYYYYMM(ts), ORDER BY (tenant_id, ts), and low-cardinality types (LowCardinality(String), DateTime, appropriate integer widths) to cut storage.
  3. Load with batches: buffer upstream, insert in chunks, monitor system.parts count per table — sustained growth signals an insert problem.
  4. Write queries that prune: filter on the sorting key prefix, avoid SELECT *, use PREWHERE for highly selective filters on non-key columns, and prefer approximate functions for exploratory work.
  5. Handle mutations carefully: ALTER UPDATE/DELETE are heavyweight background operations — fine occasionally, not a workload pattern. Design around append-mostly data.
  6. Operate: replicate with ReplicatedMergeTree + ZooKeeper/ClickHouse Keeper, shard by a hash key for scale-out, back up with filesystem snapshots or BACKUP TABLE, and monitor merge/mutation queues.

Common pitfalls

  • Row-by-row inserts — the #1 ClickHouse anti-pattern; causes part explosion, merge backlog, and degraded queries. Batch always.
  • High-cardinality first in ORDER BY (e.g. a UUID) — destroys compression and pruning; order by commonly filtered low/medium-cardinality columns first.
  • Using FINAL on huge tables routinely — forces full merges at query time; use it sparingly or design deduplication into the pipeline.
  • Treating it like Postgres — frequent small updates, heavy joins, and transactional expectations fight the architecture. ClickHouse is append-mostly analytics.
  • Ignoring data types: String for everything wastes 5–10x storage vs LowCardinality(String) and right-sized numerics; storage is query speed in a columnar engine.
  • No TTL / retention policy on ever-growing event tables — disk fills, merges slow, queries degrade. Set TTL or drop old partitions on a schedule.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Master 1Password: vaults, Watchtower, passkeys, SSH agent, CLI, and family/team administration. Use when getting full value from 1Password personally or administering it for others.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aicodedecode/awesome-muse-skills252026년 10월 10일 업데이트

Create 3D visuals with modeling, texturing, lighting, rendering, and optimization for web and product.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aicodedecode/awesome-muse-skills252026년 10월 10일 업데이트

Create 3D web experiences: scene setup, models, materials, lighting, animation, scroll-driven scenes, and performance budgets. Use when adding 3D to websites beyond basic demos.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aicodedecode/awesome-muse-skills252026년 10월 10일 업데이트

Writing abstracts that get papers read — structured content, the 5-sentence core, and journal-specific constraints.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aicodedecode/awesome-muse-skills252026년 10월 10일 업데이트

Learn effectively from courses and academies: choosing programs, studying actively, and converting courses into skills. Use when investing time/money in structured learning.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aicodedecode/awesome-muse-skills252026년 10월 10일 업데이트

Audit designs for accessibility with WCAG checklists covering color, type, focus, motion, and content.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aicodedecode/awesome-muse-skills252026년 10월 10일 업데이트

aicodedecode의 스킬 모두 보기

이 스킬의 문제 신고