ClickHouse
Open-source column-oriented database that delivers real-time analytical queries on petabyte-scale data with millisecond latency.
ClickHouse is an open-source, column-oriented database management system purpose-built for real-time online analytical processing (OLAP). It stores data by columns rather than rows, enabling extreme compression ratios and the ability to scan only the columns needed for each query — a fundamental design decision that allows it to execute complex aggregations over billions of rows in milliseconds rather than minutes.
The system is deployed by engineering teams at companies including Tesla, Lyft, Cloudflare, and Anthropic who need analytical query performance that traditional data warehouses cannot match. ClickHouse runs on a single laptop via a standalone binary or scales horizontally to petabyte-scale distributed clusters, making it equally useful for local file analysis and production observability pipelines handling millions of events per second.
ClickHouse ships with a rich ecosystem of built-in storage engines (MergeTree, ReplicatedMergeTree, AggregatingMergeTree, SummingMergeTree), a vectorized query execution pipeline built in C++, native connectors for Kafka, S3, HDFS, PostgreSQL, MySQL, and object storage data lakes including Iceberg, Delta Lake, and Hudi. A managed cloud offering on AWS, GCP, and Azure handles infrastructure concerns for teams that want the performance without the operational overhead.
The project has been actively developed since 2016, has over 48,000 GitHub stars, releases monthly stable versions with a concurrent LTS track, and maintains a global community across 100+ countries with regular in-person meetups and an active Slack.
What You Get
- MergeTree Storage Family - A suite of specialized table engines (MergeTree, AggregatingMergeTree, SummingMergeTree, CollapsingMergeTree) each optimized for specific analytical workloads, with automatic data part merging and primary key sorting built in.
- Vectorized Execution Engine - Queries are executed in batches of columns using SIMD instructions, processing data in wide CPU-cache-friendly vectors rather than row-by-row, delivering multi-gigabyte-per-second analytical throughput.
- PREWHERE Clause Optimization - An optimizer that evaluates the cheapest filter conditions before reading the primary data columns, drastically reducing I/O for common analytical query patterns.
- Data Lake Integration - Native read/write support for Apache Iceberg, Delta Lake, Hudi, and Paimon formats stored on S3, Azure Blob, GCS, or HDFS, enabling direct lakehouse querying without ETL.
- ClickHouse Local - A self-contained binary that runs SQL queries directly against local CSV, TSV, Parquet, JSON, and other file formats with no server or configuration required.
- Distributed Query Execution - Built-in sharding and replication via ReplicatedMergeTree and Distributed table engines, with automatic data locality-aware query routing across cluster nodes.
- Built-in Vector Search - Approximate nearest neighbor (ANN) index support for storing and searching vector embeddings alongside structured data, enabling hybrid analytical and AI workloads in a single database.
- 100+ Integrations - First-party connectors for Kafka, RabbitMQ, NATS, PostgreSQL, MySQL, MongoDB, Redis, Grafana, Metabase, Superset, dbt, Airbyte, and Langfuse among many others.
Common Use Cases
- Real-Time Observability Pipelines - A platform engineering team ingests billions of log events, metrics, and distributed traces per day from microservices into ClickHouse via Kafka, then powers sub-second Grafana dashboards for on-call engineers without pre-aggregation.
- LLM Observability and Evaluation - An AI team stores every prompt, completion, token count, and latency metric from their LLM API calls in ClickHouse through Langfuse, running ad-hoc SQL to detect prompt regressions and track model quality over millions of inferences.
- Clickstream and User Behavior Analytics - An e-commerce company ingests every page view, add-to-cart, and checkout event directly into ClickHouse and serves product managers live funnel dashboards that update within seconds of user actions.
- Security Analytics and Threat Detection - A security team stores network flow logs and authentication events in ClickHouse, running continuous windowed aggregations to detect anomalies and correlate events across billions of rows in real time.
- Financial Time-Series Analysis - A quantitative trading firm stores tick-by-tick market data in ClickHouse and runs complex time-series SQL with window functions and custom aggregate functions to backtest strategies against years of historical data.
- Data Lake Ad-Hoc Querying - A data engineering team uses ClickHouse to query Apache Iceberg tables stored on S3 directly with SQL, replacing ad-hoc Spark jobs for exploration tasks that previously took minutes.
Under The Hood
Architecture ClickHouse employs a deeply layered, modular architecture with strict separation between the storage layer, query processing pipeline, and network/protocol tier. Data storage is handled by a family of MergeTree engines that organize column data into sorted, compressed parts on disk and merge them in the background — a design that keeps write throughput high while keeping read amplification low. Queries flow through a multi-stage pipeline: the SQL parser produces an AST, the Analyzer rewrites and validates it into a query tree, the Planner converts it into a physical execution plan, and the Processor pipeline executes it as a directed acyclic graph of streaming transforms that process columnar Chunks through the CPU pipeline. The Storages, Interpreters, Processors, and Parsers directories each represent clean abstraction boundaries, making independent optimization of each layer possible without cascading changes.
Tech Stack The core engine is written in C++ with deliberate use of SIMD intrinsics and LLVM-based JIT compilation to accelerate hot query paths. Build management uses CMake with a custom dependency management layer for the extensive contrib directory of vendored third-party libraries. The ANTLR4 grammar defines the SQL dialect and generates the parser. Rust is used for select systems components via the rust/ directory. Python drives the CI infrastructure, integration test harness (pytest with a custom conftest), and performance benchmarking tooling. The distributed coordination layer uses a built-in ClickHouse Keeper (a ZooKeeper-compatible implementation in C++) instead of requiring an external ZooKeeper cluster. Cap’n Proto handles internal binary serialization between cluster nodes.
Code Quality ClickHouse maintains an extensive test suite with over 8,800 stateless SQL query tests in tests/queries/, more than 2,000 Python-driven integration tests in tests/integration/ covering scenarios such as S3 failover, Iceberg compatibility, Kafka ingestion, and replication edge cases, and dedicated fuzz testing directories. The codebase enforces strong type safety through explicit column type declarations in the DataTypes layer and uses structured profile events and system table logging for performance monitoring and error attribution rather than ad-hoc logging. The CI system via GitHub Actions and a custom Praktika CI framework runs builds, tests, and benchmarks across multiple platforms and compilers, with a separate performance comparison pipeline to catch regressions between releases. Code comment density is moderate — key algorithmic sections carry explanatory comments while infrastructure boilerplate is left self-documenting through naming.
What Makes It Unique ClickHouse’s most distinctive technical contribution is the combination of the PREWHERE optimization with the MergeTree storage format: by evaluating cheap predicate expressions against a sparse primary index before reading the full column data, it avoids I/O that other columnar systems only skip at the decompression stage. The AggregatingMergeTree engine enables stateful incremental aggregation — partial aggregate states are stored as column data and merged automatically during background operations, making real-time materialized views over high-throughput insert streams practical without external stream processors. The built-in ClickHouse Keeper eliminates ZooKeeper as an external dependency for replication, reducing operational complexity significantly. The recent addition of native DataLake format support (Iceberg, Delta Lake, Hudi, Paimon) alongside traditional S3/GCS/HDFS table functions positions ClickHouse as a unified analytical engine that can query both streaming ingested data and open table format lakehouse data with identical SQL.
Self-Hosting
ClickHouse is released under the Apache License 2.0, one of the most permissive open-source licenses available. You are free to use, modify, distribute, and run ClickHouse in commercial production environments without any licensing fees, royalties, or obligations to open-source your own application code. There is no open-core split in the GitHub repository — the code you clone is the complete database engine without feature gating for enterprise tiers. The Apache 2.0 license does require preserving copyright notices and the license text itself, but imposes no copyleft requirements on software that uses or integrates ClickHouse.
Running ClickHouse yourself is operationally demanding at any meaningful scale. The database requires careful tuning of merge settings, memory limits, and query concurrency parameters that are not obvious from defaults. Cluster deployments need ClickHouse Keeper (or an external ZooKeeper) for replication coordination, careful shard key selection, and ongoing monitoring of part counts and merge backlogs. You are responsible for provisioning enough disk throughput and RAM (columnar analytics is memory-intensive for large aggregations), managing rolling upgrades across cluster nodes without downtime, and maintaining backups using the built-in BACKUP/RESTORE commands or third-party tooling. The upgrade cadence — monthly stable releases with a separate LTS track — means keeping current requires disciplined release management.
ClickHouse Cloud, the managed service built and operated by the ClickHouse team on AWS, GCP, and Azure, removes the operational burden entirely. It handles auto-scaling compute separately from storage (a shared-storage architecture), automated backups, zero-downtime upgrades, high-availability by default, and provides support SLAs that are unavailable with the self-hosted community edition. The cloud tier also includes features like query insights dashboards and role-based access controls in a managed UI that require manual setup when self-hosting. For teams whose core competency is not database operations, ClickHouse Cloud represents a significant reduction in total cost of ownership despite the per-query compute pricing premium over running your own hardware.
Related Apps
Supabase
Developer Tools · Databases · Search
The open-source Postgres development platform that replaces Firebase with authentication, real-time APIs, edge functions, storage, and vector embeddings — all built on PostgreSQL.
Supabase
Apache 2.0Grafana
Monitoring · Analytics
The open-source observability platform that unifies metrics, logs, and traces from any data source into dynamic, queryable dashboards.
Grafana
AGPL 3.0OpenBB
Databases · Analytics · Invoicing Finance
The AI Workspace for Finance: Connect Data, Run AI Agents, Build Analytics