Skip to content
Table Format Maintenance & Operations Last updated: May 29, 2026

Iceberg Spark Procedure rewrite_manifests

A Spark SQL maintenance procedure in Apache Iceberg used to reorganize and merge small manifest files to optimize query planning latency.

rewrite_manifests sparkiceberg manifest compactionspark sql call rewrite_manifests

Iceberg Spark Procedure rewrite_manifests

The Iceberg Spark Procedure rewrite_manifests is a table maintenance utility executed via Spark SQL. When tables experience frequent write commits, they accumulate many small manifest files. Each manifest file must be parsed by the query coordinator during the planning phase to determine which data files match a query. Consolidating small manifests into a smaller set of larger files reduces query planning latency.

Syntax and Behavior

The procedure merges small manifests, matching the target configuration sizing (typically 8 MB or 16 MB per manifest), and aligns file boundaries with active partition specifications:

/* Consolidate small manifest files on the target table */
CALL prod.system.rewrite_manifests(
    table => 'db.web_logs'
);

Manifest Alignment and Partition Pruning

When rewrite_manifests executes, it reorganizes manifest entry records:

Running this procedure periodically is a best practice for tables subjected to continuous streaming data writes.

๐Ÿ“š Go Deeper on Apache Iceberg

Alex Merced has authored three hands-on books covering Apache Iceberg, the Agentic Lakehouse, and modern data architecture. Pick up a copy to master the full ecosystem.

โ† Back to Iceberg Knowledge Base