clickhouse-io

Implements ClickHouse table design, query optimization, and analytics patterns for OLAP workloads.

Updated Mar 25, 2026
One-click install
npx skills add https://github.com/Femad-6/my-skills --skill clickhouse-io-femad-6
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clickhouse-io
Source: https://github.com/Femad-6/my-skills/tree/main/.github/skills/clickhouse-io
Command: npx skills add https://github.com/Femad-6/my-skills --skill clickhouse-io-femad-6

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Designing efficient ClickHouse schemas and writing performant analytical queries requires specialized knowledge of MergeTree engines, partitioning, and aggregation functions that differs significantly from traditional row-based databases. ## Core Features & Use Cases - Table Design Patterns: Provides templates for MergeTree, ReplacingMergeTree, and AggregatingMergeTree engines with proper partitioning and ordering keys. - Query Optimization: Covers efficient filtering, ClickHouse-specific aggregation functions like quantile and uniq, window functions, and materialized views for real-time aggregations. - Data Pipeline Patterns: Includes bulk insert strategies, streaming inserts, ETL workflows, and CDC synchronization from PostgreSQL. - Use Case: When migrating analytics from PostgreSQL to ClickHouse, use this Skill to design a partitioned MergeTree table, write batch insert logic in TypeScript, and build materialized views for hourly dashboards. ## Quick Start Help me design a ClickHouse table for time-series events and write an optimized aggregation query for daily active users.

Frequently Asked Questions about clickhouse-io

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

FAQPage Schema
How do I design a ClickHouse table for analytics?

Use the MergeTree engine with a time-based partition key like toYYYYMM(date) and an ORDER BY clause placing frequently filtered columns first. Choose the smallest appropriate data types and consider LowCardinality for repeated string values.

How to optimize slow ClickHouse queries?

Filter on indexed columns first, avoid SELECT *, and use ClickHouse-specific functions like quantile and uniq instead of generic equivalents. Check system.query_log for queries exceeding duration thresholds and review partition pruning behavior.

What is the difference between MergeTree and ReplacingMergeTree?

MergeTree is the standard engine for append-only analytical data, while ReplacingMergeTree deduplicates rows with the same sorting key during background merges. Use ReplacingMergeTree when data may arrive from multiple sources with potential duplicates.

Can I migrate analytics from PostgreSQL to ClickHouse?

Yes, use an ETL pattern that extracts rows from PostgreSQL, transforms them into columnar-friendly structures, and batch inserts into ClickHouse. For ongoing sync, implement change data capture using PostgreSQL LISTEN/NOTIFY to stream updates.

Why are individual inserts slow in ClickHouse?

ClickHouse is optimized for batch inserts because each insert creates data parts that require background merges. Insert rows in large batches or use streaming inserts rather than looping single-row INSERT statements.

When should I use materialized views in ClickHouse?

Use materialized views with AggregatingMergeTree to maintain pre-aggregated metrics like hourly sums and unique counts in real time. Query them with merge functions such as sumMerge and uniqMerge instead of recomputing aggregates from raw events.