clickhouse-io

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

Updated Mar 18, 2026
One-click install
npx skills add https://github.com/freedom909/real-estate-saas --skill clickhouse-io-freedom909
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: clickhouse-io
Source: https://github.com/freedom909/real-estate-saas/tree/main/.trae/skills/clickhouse-io
Command: npx skills add https://github.com/freedom909/real-estate-saas --skill clickhouse-io-freedom909

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Designing and optimizing ClickHouse for analytical workloads requires specialized knowledge of column-oriented storage, MergeTree engines, and batch ingestion that differs significantly from traditional row-based databases like PostgreSQL or MySQL. ## Core Features & Use Cases - Table Design Patterns: Guidance on MergeTree, ReplacingMergeTree, and AggregatingMergeTree engines with partitioning and ordering key strategies. - Query Optimization: Patterns for efficient filtering, aggregations, window functions, and materialized views for real-time analytics. - Data Ingestion & Pipelines: Bulk insert, streaming insert, ETL, and change data capture patterns from PostgreSQL to ClickHouse. - Use Case: Migrating a time-series analytics dashboard from PostgreSQL to ClickHouse, including schema design, hourly pre-aggregated materialized views, and hourly ETL sync jobs. ## Quick Start Ask the AI to design a ClickHouse table schema and optimized analytical queries for your time-series event data.

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 schema 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 LowCardinality for repeated strings to improve compression.

How to optimize slow ClickHouse queries?▼

Filter on indexed columns from the ORDER BY key first, avoid SELECT *, and use ClickHouse-specific functions like quantile instead of percentile. Check system.query_log for queries exceeding duration thresholds and review partition pruning behavior.

What is the difference between MergeTree and ReplacingMergeTree?▼

ReplacingMergeTree deduplicates rows with the same sorting key during background merges, making it suitable for data arriving from multiple sources. Standard MergeTree keeps all inserted rows and is the default choice for append-only analytics data.

Can I migrate analytics from PostgreSQL to ClickHouse?▼

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

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 stats in real time as data arrives. Query them with merge functions such as sumMerge and uniqMerge instead of aggregating raw events repeatedly.