# Iceberg compaction (rewrite_data_files)

Glossary, read 10 Nov 2026

**The short answer.** Iceberg compaction rewrites many small data files into fewer large ones. In Spark it is run with the rewrite_data_files procedure, which combines files in parallel to cut metadata overhead and file-open cost. The default strategy is binpack; sort is the alternative, with optional Z-order or Hilbert ordering.

Compaction is a Spark job you pay for, repeatedly. Streaming and frequent small writes make it a daily cost, so it is a common target for acceleration.

Sort-based compaction shuffles and sorts data, which is the work FPGA and native options say they speed up.

## A sourced example

The Iceberg procedure defaults to a 512 MB target (write.target-file-size-bytes, 536870912), rewrites files under 75% of that size and files over 180% of it.

## Sources

- Apache Iceberg documentation: Spark procedures: https://iceberg.apache.org/docs/latest/spark-procedures/ (read 10 Nov 2026)

Last reviewed 10 Nov 2026. Canonical: https://sparkaccelerationcompare.com/glossary/iceberg-compaction/
