clickhouse-io
From affaan-m
ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.
Provides ClickHouse SQL patterns for table design, query optimization, batch inserts, and materialized views.
Use it when
- Designing MergeTree, ReplacingMergeTree, or AggregatingMergeTree tables
- Writing analytical SQL with aggregation, quantiles, or window functions
- Setting up bulk or streaming inserts via @clickhouse/client in TypeScript
- Building materialized views for real-time hourly stats or monitoring slow queries
Skip it if
- Not using ClickHouse as your database
- TypeScript examples assume @clickhouse/client, irrelevant for other languages/drivers
- Reference document of SQL/code snippets, not an executable tool
Facts
- Repository
- affaan-m/ECC
- Status
- Actively maintained
- Last commit
- Source file
- docs/ja-JP/skills/clickhouse-io/SKILL.md
Source preview
The instructions Claude Code reads when this skill runs.
# ClickHouse 分析パターン
高性能分析とデータエンジニアリングのためのClickHouse固有のパターン。
## 概要
ClickHouseは、オンライン分析処理(OLAP)用のカラム指向データベース管理システム(DBMS)です。大規模データセットに対する高速分析クエリに最適化されています。
**主な機能:**
- カラム指向ストレージ
- データ圧縮
- 並列クエリ実行
- 分散クエリ
- リアルタイム分析
## テーブル設計パターン
### MergeTreeエンジン(最も一般的)
```sql
CREATE TABLE markets_analytics (
date Date,
market_id String,
market_name String,
volume UInt64,
trades UInt32,
unique_traders UInt32,
avg_trade_size Float64,
created_at DateTime
) ENGINE = MergeTree()
PARTITION BY toYYYYMM(date)
ORDER BY (date, market_id)
SETTINGS index_granularity = 8192;
```
### ReplacingMergeTree(重複排除)
```sql
-- 重複がある可能性のあるデータ(複数のソースからなど)用
CREATE TABLE user_events (
event_id String,
user_id String,
event_type String,
timestamp DateTime,
properties String
) ENGINE = ReplacingMergeTree()
PARTITION BY toYYYYMM(timestamp)
ORDER BY (user_id, event_id, timestamp)
PRIMARY KEY (user_id, event_id);
```
### AggregatingMergeTree(事前集計)
```sql
-- 集計メトリクスの維持用
CREATE TABLE market_stats_hourly (
hour DateTime,
market_id String,
total_volume AggregateFunction(sum, UInt64),
total_trades AggregateFunction(count, UInt32),
unique_users AggregateFunction(uniq, String)
) ENGINE = AggregatingMergeTree()
PARTITION BY toYYYYMM(hour)
ORDER BY (hour, market_id);
-- 集計データのクエリ
SELECT
hour,
market_id,
sumMerge(total_volume) AS volume,
View full source on GitHub →Other skills
django-tdd
★ 229,918Django testing strategies with pytest-django, TDD methodology, factory_boy, mocking, coverage, and testing Django REST Framework APIs.
affaan-mupdated 15d agoMITlaravel-patterns
★ 229,918Patrones de arquitectura Laravel, routing/controladores, Eloquent ORM, capas de servicio, colas, eventos, caché y API resources para aplicaciones en producción.
affaan-mupdated 15d agoMITverification-loop
★ 229,918Sistema de verificación completo para sesiones de Claude Code.
affaan-mupdated 15d agoMITstrategic-compact
★ 229,918Suggests manual context compaction at logical intervals to preserve context through task phases rather than arbitrary auto-compaction.
affaan-mupdated 15d agoMITfrontend-patterns
★ 229,918Patrones de desarrollo frontend para React, Next.js, gestión de estado, optimización de rendimiento y buenas prácticas de UI.
affaan-mupdated 15d agoMITfal-ai-media
★ 229,918Unified media generation via fal.ai MCP — image, video, and audio. Covers text-to-image (Nano Banana), text/image-to-video (Seedance, Kling, Veo 3), text-to-speech (CSM-1B), and video-to-audio (ThinkSound). Use when the user wants to generate images, videos, or audio with AI.
affaan-mupdated 15d agoMIT