HomeGuidesIceberg

Iceberg Compaction Explained: Bin-Pack vs. Sort

Shachar Shamir
October 18, 2026
7
min read

Streaming and frequent batch writes leave Apache Iceberg tables with many small data files. Compaction rewrites them into fewer, larger files so queries read less metadata and open fewer files.

Why small files hurt performance

Every file adds planning overhead and an object-store request. Thousands of small files can make simple queries slow and expensive, even when the total data size is modest.

Compaction strategies

Bin-pack

Bin-pack combines small files into files close to the target size without changing row order. It is the fastest and cheapest strategy and is a good default.

Sort

Sort compaction rewrites data ordered by one or more columns. Queries that filter on those columns can skip more files, but the rewrite costs more compute.

Z-order

Z-order interleaves several columns so filters on any of them benefit. It is useful when queries filter on multiple columns with similar frequency.

[[cta:benchmark]]

How to choose a strategy

Start with bin-pack on a schedule. Move to sort or z-order for large tables where query patterns are stable and file skipping will save more than the extra rewrite cost.

Key takeaways

Compaction is routine maintenance for Iceberg. Schedule it, measure query time and cost before and after, and pick the cheapest strategy that meets your performance goals.

[[cta:demo]]

‍

On this page
See DualBird accelerate your own Spark workloads.
Book a demo

Related guides

Iceberg

Apache Iceberg Table Maintenance Checklist

The recurring maintenance tasks that keep Apache Iceberg tables fast and storage costs under control.

October 8, 2026
Iceberg

Iceberg Compaction Explained: Bin-Pack vs. Sort

Why Apache Iceberg tables need compaction, how bin-pack and sort strategies differ, and how to choose between them.

October 18, 2026
See 10x-30x faster Spark on your own workload
DualBird accelerates existing Spark and Iceberg jobs with no code changes.
Book a demo
How DualBird accelerates Spark and Iceberg
Purpose-built hardware, delivered like software, for big data processing on AWS.
Learn about the product →
Benchmark: Iceberg compaction, faster and cheaper
See how sort-based compaction ran faster at lower infrastructure cost, with no tuning.
Read the benchmark →
Questions about your pipeline?
Talk to an engineer about performance and cost for your workloads.
Contact us →

Transform your data infrastructure performance with a few clicks

Zero risk, zero effort, incredible results.