ClickHouse and Apache Iceberg: Using Them Together in a Big Data Architecture
Combining ClickHouse's low-latency analytics with Apache Iceberg's open, versioned data lake tables in a single architecture: data flow, Iceberg metadata structure, sample tables for 300 million events per day, and hot/cold data queries.
The core problem in big data systems is not only storing billions of records. The real challenge is collecting these records from different sources, managing them reliably, accessing their historical versions, and running fast analytical queries over large datasets.
ClickHouse focuses on query performance, while Apache Iceberg focuses on open and reliable data lake table management. Using the two together brings low-latency analytics and long-term data storage into the same architecture.
1. What are ClickHouse and Apache Iceberg?
ClickHouse: A column-oriented OLAP database. It is built for fast filtering, grouping, aggregation, and analytical queries over big data.
Apache Iceberg: An open table format that gives data lakes table structure, snapshots, schema evolution, and transactional consistency. It is not a query engine on its own; it works with engines such as Spark, Flink, Trino, or compatible ClickHouse versions.
| Feature | ClickHouse | Apache Iceberg |
|---|---|---|
| Primary role | Analytical query engine | Open table format |
| Data storage | MergeTree and other engines | Parquet and other data files |
| Query execution | Built-in SQL engine | Requires an external engine |
| Main strength | Low query latency | Open and versioned data management |
| Historical access | Depends on the data model | Snapshots and time travel |
| Typical use | Dashboards, operational analytics | Data lake, ETL, historical analysis |
2. Why should they be used together?
In a system that produces hundreds of millions of events per day, keeping all data only in a fast analytical database can increase costs. Keeping data only in Iceberg and object storage, on the other hand, may not deliver the latency expected for every interactive query.
Iceberg provides long-term retention, open data access, and snapshot management. ClickHouse becomes the analytical access layer for frequently queried records, dashboards, and operational reporting. It is not necessary to store all data twice; only frequently used data or summaries can be moved to ClickHouse.
3. Recommended big data architecture
Diagram 1 — Hybrid lakehouse data flow
API / CDC / Log / IoT
│
▼
Apache Kafka
(event stream)
│
┌──────────┴──────────┐
▼ ▼
ClickHouse Apache Iceberg
MergeTree / Hot S3 / MinIO / ADLS
- Applications send events to Kafka.
- ClickHouse consumes the events for low-latency analysis.
- Flink/Spark writes the same stream into Iceberg tables.
- Object storage holds the files, and the catalog manages the metadata locations.
- ClickHouse can query Iceberg directly or move selected data into MergeTree.
- The dashboard and API layer uses ClickHouse.
Note: Writing to the two targets in the diagram does not guarantee automatic synchronization; consistency must be designed separately.
4. Iceberg internals: Metadata and snapshots
Diagram 2 — Iceberg metadata hierarchy
Catalog
│
▼
Table Metadata
│
▼
Manifest List
│
▼
Manifest Files
│
▼
Parquet data files
The catalog points to the current metadata location of the table. The metadata holds schema and snapshot references. Manifest lists and manifest files provide the paths of data files, partition information, and statistics. This allows the processing engine to skip unnecessary files for suitable queries.
Snapshots and time travel
Diagram 3 — Snapshot chain
[S1] Initial load ──▶ [S2] New records ──▶ [S3] Current table
Successful table changes can create new snapshots. As long as previous snapshots are retained, historical states can be queried. Snapshot retention and cleanup policies must be configured correctly; old files are not kept forever automatically.
5. Practical Example: 300 Million Events per Day
Assumption: 300 million events per day, with 90 days of hot data in ClickHouse and a 5-year historical retention target in Iceberg. At one day's worth of 300 million events, 30 days amount to 9 billion, 90 days to 27 billion, one year to 109.5 billion, and five years to approximately 547.5 billion events. These figures are capacity planning assumptions.
5.1. ClickHouse MergeTree Table
CREATE DATABASE IF NOT EXISTS analytics;
CREATE TABLE analytics.events_hot
(
event_id UUID,
event_time DateTime64(3, 'UTC'),
entity_id String,
event_type LowCardinality(String),
source_system LowCardinality(String),
country_code FixedString(2),
payload String,
ingested_at DateTime64(3, 'UTC') DEFAULT now64(3)
)
ENGINE = MergeTree
PARTITION BY toYYYYMM(event_time)
ORDER BY (entity_id, event_time, event_id)
TTL event_time + INTERVAL 90 DAY DELETE
SETTINGS index_granularity = 8192;
Monthly partitioning simplifies data management. ORDER BY affects physical sorting and index access and should be chosen based on actual query patterns. The TTL must not cause data to be deleted before Iceberg archiving has been verified.
5.2. Iceberg Table with Spark SQL
CREATE NAMESPACE IF NOT EXISTS lake.analytics;
CREATE TABLE IF NOT EXISTS lake.analytics.events_archive
(
event_id STRING,
event_time TIMESTAMP,
entity_id STRING,
event_type STRING,
source_system STRING,
country_code STRING,
payload STRING,
ingested_at TIMESTAMP
)
USING iceberg
PARTITIONED BY (days(event_time))
TBLPROPERTIES (
'format-version' = '2',
'write.format.default' = 'parquet',
'write.target-file-size-bytes' = '536870912'
);
The example assumes that an Iceberg catalog named lake has been configured. A 512 MiB file size is a target. The mappings between UUID, String, and time types, as well as time zone consistency, must be verified.
5.3. Querying Iceberg from ClickHouse
SELECT
event_type,
count() AS total_events
FROM iceberg(
'https://example-bucket.s3.amazonaws.com/warehouse/events_archive/'
)
WHERE event_time >= '2026-10-01 00:00:00'
AND event_time < '2026-11-01 00:00:00'
GROUP BY event_type
ORDER BY total_events DESC;
The address is an example. In real use, valid metadata, storage access, and a supported ClickHouse version are required. Querying Iceberg directly does not guarantee the same latency as MergeTree.
5.4. Access via a Central Catalog
CREATE DATABASE lake_catalog
ENGINE = DataLakeCatalog
SETTINGS
catalog_type = 'glue',
region = 'eu-central-1';
SHOW TABLES FROM lake_catalog;
Access to AWS Glue requires credentials and DataLakeCatalog support in the relevant ClickHouse version. The catalog simplifies table discovery and access from multiple processing engines.
6. Combining Hot and Cold Data
Diagram 4: Hot / Cold query model
HOT: ClickHouse COLD: Iceberg
last 90 days older data
└────────────┬────────────┘
▼
UNION ALL
combined analytics result
SELECT event_type, sum(total) AS total_events
FROM
(
SELECT event_type, count() AS total
FROM analytics.events_hot
WHERE event_time >= now() - INTERVAL 90 DAY
GROUP BY event_type
UNION ALL
SELECT event_type, count() AS total
FROM lake_catalog.`analytics.events_archive`
WHERE event_time < now() - INTERVAL 90 DAY
GROUP BY event_type
)
GROUP BY event_type
ORDER BY total_events DESC;
The hot and cold time ranges must not overlap and must not leave gaps. In production, it is safer to use a fixed archive boundary whose transfer has been verified, rather than relying solely on the now() - 90 DAY calculation.
7. Performance optimization
ClickHouse MergeTree reads the relevant column blocks through sorting and skipping indexes. In Iceberg queries, on the other hand, file pruning is performed using the catalog, manifests, partitions and Parquet statistics. Metadata access, network and object storage latency affect query cost.
| Parameter | Recommended approach |
|---|---|
| ClickHouse ORDER BY | Frequently used filter and access patterns |
| ClickHouse partition | A manageable number, mostly time-based |
| Iceberg partition | Day/month and suitable transforms |
| Parquet file size | 256–512 MiB for an initial test |
| Small files | Periodic compaction |
| Snapshot | Expiration and orphan file cleanup |
| Queries | Predicate pushdown, partition pruning |
| Frequently used summaries | Materialized view or MergeTree |
| Data accuracy | Deduplication, watermark, reconciliation |
A large number of small Parquet files increases object storage requests and metadata cost. File compaction and snapshot cleanup should be part of a regular maintenance plan.
8. Consistency in real-time data streaming
When data is written from Kafka to both ClickHouse and Iceberg, updating the two targets at the same time is not guaranteed. The Iceberg commit for an event that has already reached ClickHouse may not have been completed yet.
Checks:
- unique
event_id - offset/checkpoint tracking
- duplicate record detection
- safe retry
- record count and checksum reconciliation
- do not delete hot data until the archive is verified
At-least-once delivery and exactly-once processing semantics are not the same thing; end-to-end guarantees depend on the connector and the target commit behavior.
9. Current state of ClickHouse–Iceberg integration
ClickHouse's Iceberg support has evolved across versions. Iceberg v2 reading, catalog and time travel capabilities have been expanded; in 2026, Iceberg write support was announced for certain integrations. Integrations such as Amazon S3 Tables and Snowflake Horizon were announced as part of ClickHouse 26.8.
However, it should not be assumed that all Iceberg format versions, catalog types and DML operations are supported at the same level in every ClickHouse deployment. The version and feature matrix should be verified before moving to production.
10. Which architecture suits which need?
| Need | Choice and rationale |
|---|---|
| Low-latency operational analytics | ClickHouse MergeTree: dashboards, alerts, intensive filtering |
| Historical data at petabyte scale | Iceberg + object storage: open format and multi-engine access |
| Real-time + historical analysis | ClickHouse + Iceberg: hybrid hot/cold architecture |
| Audit and sensitive records | Iceberg snapshots additionally require access control, encryption, an immutable archive and an independent audit log |
Comments (0)
No comments yet; be the first.
Leave a comment