liveBook · Manning

Delete-file rewriting

As explained in Architecting an Apache Iceberg Lakehouse

Delete-file rewriting is the process of rewriting delete files and affected data files to consolidate delete state and reduce query-time merge work.

Delete-file rewriting consolidates delete state and affected data files, reducing the merge work queries must perform at read time. It is a recurring maintenance operation rather than a one-time cleanup task. section 11.1.3 section 11.1

Apply the technique according to table behavior:

  • Run it aggressively for high-velocity CDC tables, especially in merge-on-read (MOR) workloads that accumulate many delete files. section 11.1.3
  • Use table-specific schedules instead of imposing the same maintenance frequency on every dataset. section 11.1.3
  • Coordinate execution through scheduled jobs, metadata-aware triggers, or conditional workflows so maintenance remains repeatable without constant oversight. section 11.1 section 11.1.2

Triggering maintenance from metadata

A scheduled query can inspect an Iceberg table’s files metadata view, count active data and delete files below a target size, and trigger maintenance when fragmentation exceeds a predefined limit. This avoids spending resources when the table is already well organized. section 11.1.2

Figure 11.2 By using conditional logic based on data in the metadata tables (such as the size of files in a table’s current snapshot), we can avoid running maintenance work when the table doesn’t need it.

Use the conditional workflow diagram to see how metadata state can determine whether maintenance work runs. section 11.1.2

How Architecting an Apache Iceberg Lakehouse covers it

How deep it goes
Defines workload-specific scheduling and orchestration, but does not detail the rewrite algorithm or file-level implementation.
Examples
Uses high-velocity CDC tables, monthly reporting tables, and metadata thresholds for conditional maintenance.
What it assumes
Assumes familiarity with Apache Iceberg tables, delete files, snapshots, metadata, and maintenance operations.
What you can do after
Operate delete-file rewriting through scheduled, table-specific, and metadata-aware maintenance workflows.
How it connects
Connects delete-file rewriting with Apache Iceberg, merge-on-read, CDC, compaction, snapshots, metadata, and orchestration.

This explainer was generated by Manning's knowledge graph from the text of Architecting an Apache Iceberg Lakehouse. The section links point to the parts of the book it draws on.