ClickHouse + Iceberg: one query, five stops, and what gets skipped before the first byte

How ClickHouse reads Apache Iceberg tables: the iceberg() table function, the IcebergS3 engine and the DataLakeCatalog database (REST, Glue, Unity, Polaris), what it reads from the metadata tree, what it prunes before opening any Parquet file, time travel, deletes, caches, writes, and why the first query is the slow one. All from ClickHouse's docs, changelogs and release slides as of November 2026.

In one of ClickHouse’s own release-call examples, the same query on the same Apache Iceberg table took 51.2 seconds on ClickHouse 25.4 and 1.3 seconds on 25.5. Not one data file changed. The table was split into 50 buckets by the hash of an ID, and 25.5 learned to work out which bucket an ID lands in, so it could skip the other 49 without opening them.

That is the whole story of ClickHouse on Iceberg in one line: most of the speed is decided by what it doesn’t read. This post follows one query through the five stops it makes, and says at each stop what ClickHouse reads, what it can skip, and since which version.

No benchmarks were run for this post and no ClickHouse was started. Every number is quoted from ClickHouse’s documentation, changelogs, setting defaults or release-call slides (their examples, named as such), from the Iceberg spec, or from AWS’s S3 guide. Links are at the end.

Three doors into an Iceberg table

ClickHouse gives you three ways to point a query at an Iceberg table:

Door Looks like Use it for (ClickHouse’s own advice)
Table function SELECT … FROM icebergS3('s3://bucket/warehouse/events/') ad hoc queries on a known path
Table engine CREATE TABLE events ENGINE = IcebergS3('s3://…/events/') repeated queries on the same path, without a catalog
DataLakeCatalog database CREATE DATABASE lake ENGINE = DataLakeCatalog('https://catalog/v1') SETTINGS catalog_type = 'rest' production: every table in the catalog shows up, including new ones

iceberg() is an alias of icebergS3(); there are Azure, HDFS and local variants, and icebergS3Cluster() spreads file reads over the replicas of a cluster. ClickHouse reads Iceberg format versions 1 and 2; version 3 support is partial (deletion vectors are read, not written).

Our example query from here on:

SELECT count()
FROM lake.`web.events`
WHERE event_time >= yesterday() AND event_time < today()
  AND user_id = 42

The five stops

One query, five stops: four of them are metadata1 · catalogwhich metadata.json is current2 · metadata.jsonschema, partition spec, snapshot3 · manifest listskips manifests by partition range4 · manifestsskips files by partition, min/max5 · Parquet filesskips row groups, pages; reads columnsbefore any data byte
Not to scale. From the Iceberg spec and ClickHouse's Iceberg docs and release notes: partition pruning (25.1, on by default since 25.6), min/max pruning (25.4), manifest-list pruning (on by default since 26.9), Parquet row-group, bloom-filter and page pruning (input_format_parquet_*_push_down settings).

Stop 1: the catalog

The catalog has one job in this query: say which metadata.json is the current one. In Iceberg, a commit writes its new files first and then swaps that one pointer in the catalog, so the catalog is the source of truth for “now”.

ClickHouse added catalogs one by one: an Iceberg REST catalog database in 24.12, AWS Glue and Unity Catalog in 25.3, Hive Metastore in 25.5. In 25.8 they were all promoted from experimental to beta, and they still need a setting such as allow_database_iceberg = 1 (on by default in ClickHouse Cloud). Apache Polaris works through the REST type. Later releases added Microsoft OneLake, Google BigLake, AWS S3 Tables (with INSERT, 26.8) and Snowflake’s Horizon catalog (26.8). Most catalog connections are read-only; ClickHouse’s support matrix lists which ones can also create tables and insert.

One trap the docs spell out: CREATE DATABASE … ENGINE = DataLakeCatalog doesn’t validate your credentials. The database can exist while the connection is broken. Since 26.4, CHECK DATABASE lake; runs a quick health check.

Mistake 1: reading by path and trusting the folder. Without a catalog, ClickHouse has to guess. By default it lists the table’s metadata/ folder and takes the .metadata.json with the highest version number (or, with a setting, the largest last-updated-ms). That is usually right, but if several metadata files share the path, the docs tell you to pin iceberg_metadata_file_path or iceberg_metadata_table_uuid yourself. The folder only suggests; the catalog knows.

ClickHouse’s own 25.5 slide about reading tables “without the help of a data catalog” carries a footnote worth quoting: “yes, everything around Iceberg ecosystem is complicated and brittle. Sorry about that.”

Stop 2: metadata.json

This file holds the schemas, the partition spec and the list of snapshots. ClickHouse picks the current snapshot, or an older one if you ask (since 25.4):

SELECT count() FROM lake.`web.events`
SETTINGS iceberg_snapshot_id = 3547395809148285433;  -- or iceberg_timestamp_ms = 1714636800000

You can’t set both in one query, and system.iceberg_history (25.6) lists the snapshot IDs. The catch the docs point out: schema changes usually don’t create a snapshot. Add a column, then time travel to “now”, and you can get the old schema back. ClickHouse behaves like Spark here.

Reading tables whose schema evolved works for added, dropped and reordered columns, required to nullable, and the safe widenings (int to long, float to double, wider decimals). Changing nested structures isn’t supported.

Stop 3: the manifest list

One manifest list per snapshot, one entry per manifest, and for each manifest the range of partition values inside it. Since 26.9 (use_iceberg_manifest_list_partition_pruning, on by default) ClickHouse skips whole manifests whose range can’t match the filter, without opening them. In ClickHouse’s 26.9 example (a table PARTITION BY m, eight inserts of one month each, WHERE m = 5), the metadata files read went from 41 to 7.

Stop 4: the manifests

Each manifest lists data files, with each file’s partition values, row count and, per column, null counts and lower and upper bounds. Two kinds of pruning happen here:

Pruning Since Default Uses
Partition pruning 25.1 (time transforms), truncate 25.3, bucket 25.5 on since 25.6 (use_iceberg_partition_pruning) partition values per file
Min/max pruning 25.4 on lower_bounds / upper_bounds per column

In the same 26.9 example, the data files listed went from 39 to 5. Still not one byte of Parquet read. The 51.2-second query from the top is this stop: before 25.5, a table partitioned with bucket(50, watchid) couldn’t be pruned by watchid; 25.5 added icebergBucket and hashes the ID the way Iceberg does.

Mistake 2: filtering on the wrong column. ClickHouse’s best-practices page is blunt: “If your filter targets a column outside the partition spec, ClickHouse scans every matching file.” With hidden partitioning, filter on the source column: if the table is partitioned by day(event_time), put the predicate on event_time (since 26.10 this also works through monotonic functions like toDate(event_time)).

Two small surprises from this stop:

  • A plain SELECT count() with no filter can be answered from the snapshot summary without opening data files (25.4, restored in 26.10 for safe row counts; skipped when equality deletes are present).
  • When ClickHouse writes Iceberg, it leaves out min/max bounds for types it can’t serialize, such as UUID, so readers can’t prune those files by that column.

Stop 5: the Parquet files

Only now does ClickHouse touch your data, and even here it reads the footer first: row groups whose min/max can’t match are skipped (input_format_parquet_filter_push_down), then bloom filters (on since 25.5) and pages via the column index (25.8). It reads only the columns you select, so SELECT * pulls every column over the network. Since 26.2, PREWHERE works on Iceberg reads too.

Deleted rows are filtered here as well: position deletes, equality deletes since 25.8, and Iceberg v3 deletion vectors (read-only). Tables with lots of deletes “apply merge-on-read filtering during scans”, so expect more work per file than the pruning suggests.

To check what really happened, group by the _path virtual column, or run the query with iceberg_metadata_log_level and read system.iceberg_metadata_log (25.9), which records pruning decisions.

Why the first query is the slow one

Bucket query, 25.4no bucket pruningBucket query, 25.4: 51.2 s51.2 sBucket query, 25.5bucket pruningBucket query, 25.5: 1.3 s1.3 sManifest decodingone at a timeManifest decoding: 8.45 s8.45 sManifest decoding4 threads (default)Manifest decoding: 2.55 s2.55 sManifest decoding16 threadsManifest decoding: 1.68 s1.68 s
Quoted, not measured here: ClickHouse's release-call slides for 25.5 (bucket-partition pruning, table created in AWS Athena with bucket(50, watchid), WHERE watchid = … LIMIT 10) and 26.9 (parallel manifest decoding, example from the pull request). Two different setups, one chart; bars to scale within it.

Stops 1 to 4 are files in object storage. AWS’s own guide puts small S3 requests at roughly 100 to 200 milliseconds each. ClickHouse keeps metadata.json, manifest lists and manifests in an in-memory metadata cache (since 25.4, on by default, 128 MB by default since 26.6), but the first query after a restart, or on a new table, finds it empty.

How much work planning can be is visible in ClickHouse’s 26.9 slide: decoding 18 manifests, 113 MB, about 75,000 entries took 8.45 s one at a time, 2.55 s with 4 threads (the default) and 1.68 s with 16 threads. 26.8 added prefetching of the next manifest; before that, each one paid the object-storage latency in turn.

And by default (iceberg_metadata_staleness_ms = 0) every query asks the catalog, or lists the folder, for the latest version first. If a little staleness is fine, the docs suggest pairing two settings:

CREATE TABLE events ENGINE = IcebergS3('s3://bucket/warehouse/events/')
SETTINGS iceberg_metadata_async_prefetch_period_ms = 60000;

SELECT count() FROM events SETTINGS iceberg_metadata_staleness_ms = 60000;

For the Parquet files themselves, configure a filesystem cache disk so hot files stay on local disk (enable_filesystem_cache; ClickHouse Cloud manages this for you). And when benchmarking, the docs ask you to turn that cache off so cache hits don’t hide changes.

Many small files

Every streaming batch adds data files and often a manifest. A long manifest list slows planning, because every manifest that survives has to be read. Iceberg’s default target file size is 512 MB, and somebody has to compact toward it. ClickHouse can now merge manifests itself with OPTIMIZE TABLE … MANIFEST (experimental, only above 100 manifests by default) and merge position delete files into data files with OPTIMIZE TABLE, but rewriting small data files is usually the writer’s or a maintenance job’s work.

Writing back

INSERT into Iceberg arrived in 25.7 and is beta since 26.2 (allow_insert_into_iceberg = 1). ClickHouse can also create Iceberg tables, run ALTER TABLE … DELETE (it writes position delete files), evolve simple column types, expire snapshots and remove orphan files; the support matrix marks most of these experimental, and UPDATE/MERGE as not supported.

One type trap: ClickHouse can’t create an Iceberg column as UInt64, because Iceberg’s widest integer is a signed 64-bit long. Use Int64 or Decimal(20, 0).

When to copy into MergeTree instead

Iceberg is the shared copy every engine can read. For dashboards that need low latency at high concurrency, ClickHouse’s own data-lake page says to load the data into its MergeTree engine, as a real-time layer on top of the lake. Many setups do both: Iceberg as the source of truth, the hot slice in MergeTree.

Checklist

  1. Use DataLakeCatalog for production; run CHECK DATABASE after creating it (26.4+).
  2. By path, pin the metadata file or table UUID if several tables or writers share a folder.
  3. Filter on the partition source column; check with _path or system.iceberg_metadata_log.
  4. Select only the columns you need.
  5. Expect the first query to be slow; use async prefetch + iceberg_metadata_staleness_ms if minutes-old data is fine, and a filesystem cache for Parquet.
  6. Keep files big and manifests few; somebody has to compact.

Which catalog holds your Iceberg tables today: Glue, a REST catalog, Unity, Polaris, or none yet? The video version of this post asks the same question.

Sources