# ClickHouse Analytics taste of a data engineer who wants dashboards under one second
- Use ClickHouse for append-heavy analytical events and keep transactional data in Postgres; do not treat it as an OLTP store. Confidence: 0.95
- Default to the MergeTree family and choose the engine on purpose: ReplacingMergeTree for upserts, AggregatingMergeTree for rollups. Confidence: 0.90
- Pick ORDER BY from the most common filters, low cardinality first (tenant_id, event_type, toDate(ts), ts). Confidence: 0.90
- Partition by month (toYYYYMM) or not at all; never partition by high-cardinality keys like user_id. Confidence: 0.90
- Use LowCardinality(String) for repeated values like country, plan and event name. Confidence: 0.85
- Use the smallest fitting numeric types and DateTime64 in UTC; avoid Nullable unless null really means something. Confidence: 0.85
- Insert in batches of thousands to hundreds of thousands of rows, or turn on async_insert; never insert row by row. Confidence: 0.95
- Ingest from Kafka through a Kafka engine table plus a materialized view into the real MergeTree table. Confidence: 0.80
- Build materialized views into AggregatingMergeTree tables with -State functions and read them with -Merge functions. Confidence: 0.85
- Do not rely on FINAL for every query on ReplacingMergeTree; design queries with argMax or accept eventual merges. Confidence: 0.75
- Select only the columns you need; SELECT * on a wide table defeats the columnar format. Confidence: 0.90
- Use uniq or uniqCombined for distinct counts on dashboards and keep uniqExact for billing-grade numbers. Confidence: 0.80
- Add data-skipping indexes (minmax, bloom_filter) only after EXPLAIN shows wasted granules, not up front. Confidence: 0.75
- Put the smaller table on the right side of a JOIN, or replace dimension joins with dictionaries. Confidence: 0.85
- Set TTL rules to delete or move old raw data to cheaper storage, and keep rollups longer than raw events. Confidence: 0.85
- Manage schema with versioned migration files in git, using ON CLUSTER statements when running a cluster. Confidence: 0.80
- Give each consumer a separate user with settings profiles and quotas (max_memory_usage, max_execution_time). Confidence: 0.85
- Watch system.query_log, system.parts and merge activity; alert on too many parts per partition. Confidence: 0.85
- Avoid lightweight DELETE and ALTER UPDATE for routine work; model changes as new rows instead. Confidence: 0.80
- Back up with BACKUP TO S3 or clickhouse-backup on a schedule and test a restore every quarter. Confidence: 0.75
- Run integration tests against a real ClickHouse container with sample data, not an SQLite stand-in. Confidence: 0.75
- Prefer ClickHouse Cloud or a managed service for small teams; self-host only when someone owns operations. Confidence: 0.65
Comments & Questions (0)
No comments yet
Be the first to comment!