Apache Iceberg logo

Efficient Compaction

Efficient Compaction for
Apache Iceberg

LakeOps's purpose-built Rust engine compacts Iceberg tables 95% faster than Spark — query-aware data sorting, bounded memory, and continuous optimization keep every table lean and fast without manual intervention.

95%faster than Spark
51%less data scanned
12×query acceleration
$5/TBvs $50 with Spark

The Engine

Built on Rust & Apache DataFusion

No JVM. No garbage collection pauses. No OOM crashes. LakeOps compaction is a purpose-built Rust binary powered by Apache DataFusion — the same query engine behind Apache Arrow and InfluxDB 3.0.

Zero-copy memory

Arrow columnar format with no serialization overhead between read, sort, and write stages.

Bounded memory

Spills to disk gracefully — compacts TB-scale tables on a single 8 GB node without OOM risk.

Native Parquet I/O

Reads and writes Parquet natively with predicate pushdown and projection — no unnecessary data copied.

Comparison

Why not just use Spark?

Spark was built for batch ETL, not continuous table maintenance. It works — but at 7× the time, 10× the cost, and with operational complexity that blocks teams from running compaction continuously.

SparkAWS S3 TablesLakeOps
200 GB benchmark1,612s6,300s221s
Peak throughput~350 MB/s~32 MB/s2,522 MB/s
Memory modelJVM heap + GCManagedBounded (no OOM)
Query-aware sortManual configNoAutomatic
InfrastructureCluster requiredManagedServerless
Cost per TB~$40–80~$15$5

Benchmark: 200 GB / 600M rows, Parquet, partitioned by date. Same hardware, same data, same target file size.

The problem

Why Iceberg tables accumulate technical debt

Iceberg's metadata architecture is built for fast queries. But without active maintenance, physical table state degrades — and every query pays the penalty.

Small files multiply per-query overhead

Streaming ingestion creates thousands of tiny files. Each file costs an S3 GET request, a metadata read, and a connection — query time scales with file count, not data volume.

Unsorted data defeats data skipping

Without sort order aligned to query patterns, Parquet min/max statistics are useless. Engines scan every row group regardless of predicate filters.

Fragmented manifests bloat planning time

Hundreds of small manifests force the query planner to read excessive metadata. Planning often dominates total query time at 200+ manifests per table.

Delete files compound read amplification

Merge-on-read tables accumulate position delete files. Every query reconciles deletes at read time — performance degrades linearly with delete file count.

Results

Measured impact on
real Iceberg workloads

Benchmarks from production-grade tables across multiple engines and cloud providers.

Compaction speed

95%faster

vs. Apache Spark on identical datasets

Spark
LakeOps
+ Sort

Query performance

12×faster

After compaction + layout optimization

Cost savings

80%reduction

In compute & storage spend

Table health

100%healthy

Autonomous maintenance keeps every table optimized

TPC-DS benchmark suiteProduction Iceberg tablesMulti-cloud, multi-engine

How LakeOps Compaction Works

Four layers of
intelligent compaction.

Query-aware sorting + Rust speed + metadata optimization + delete cleanup = continuously optimized tables.

Query-aware compaction

Data sorted by how it's actually queried

LakeOps tracks which columns appear in WHERE, JOIN, and GROUP BY clauses for every table. During compaction, data is physically sorted by those columns — so Parquet row group statistics enable engines to skip irrelevant data without reading it.

  • 51% less data scanned — sorted by real filter columns, per table
  • 47,000 → 280 files: same data, same query — 52s drops to 5.8s
  • Self-improving: sort strategy adapts as query patterns evolve
Query Acceleration12× faster

Files before

47,000

Files after

280

Query before

52s

Query after

5.8s

Scan volume reduced 51%

Query-aware sort + optimized file layout

95% faster Rust engine

Tables stay optimized because compaction is fast enough to run continuously

A purpose-built Rust engine with Apache DataFusion eliminates JVM/GC overhead. Compaction completes in minutes instead of hours — so tables never degrade between maintenance windows.

  • 221s vs 1,612s (Spark) vs 6,300s (S3 Tables) on identical 200 GB
  • 2,522 MB/s peak throughput — TB-scale tables compacted in minutes
  • Bounded memory: no OOM crashes regardless of table size
Compaction Speed95% faster
6300s
S3 Tables
1612s
Spark
221s
LakeOps
780s
LakeOps Sort

Manifest & metadata optimization

Query planning stays fast at any table scale

LakeOps consolidates fragmented manifests and computes Puffin column statistics (NDV, min/max, null counts). Planners read fewer manifests and make smarter skip decisions — planning drops from seconds to milliseconds.

  • Manifest consolidation: 200+ manifests → ~30 in a single atomic rewrite
  • Puffin statistics enable aggressive file-level pruning across all engines
  • Auto-triggered after compaction cycles — manifests never drift
Metadata Optimization3 operations

Rewrite Manifests

Consolidate for faster planning

Planning

Rewrite Position Deletes

Eliminate read-time overhead

Reads

Compute Puffin Statistics

Enable aggressive file pruning

Skipping

Delete file optimization

Eliminate read-time reconciliation overhead

Position delete files from merge-on-read workloads accumulate and force every query to reconcile deletions at scan time. LakeOps consolidates and physically applies delete files so reads are always clean.

  • Rewrite Position Deletes: consolidate without full table rewrite
  • Full compaction: physically merge deletes — zero read-time overhead
  • 23,433 delete files (551M rows) cleaned in one compaction cycle
Delete File CleanupZero overhead

Delete files

23,433

After cleanup

0

Rows affected

551M

Read overhead

Eliminated

Runs on your stack

AWSAzureGoogle CloudSnowflakeDatabricksApache FlinkApache HadoopApache IcebergDelta LakeSparkLakekeeperStarRocks

Minutes to value with no risk

1

Connect & collect telemetry

Apache Iceberg
AWS
Snowflake
Trino
2

Manual or autonomous management

Manual
Autonomous
3

Operations run & optimize

Compaction
Snapshots
Orphan cleanup
Manifests & metadata
4

Observability & governance

Metrics
Health
Agents
Routing
Logs
Policies
No vendor lock-in
No code / infra changes
No data changes
Set up in 10 minutes · Works with your existing stack

Production benchmarks

5.5 TB across 10 production tables

Real workloads. Real data. Batch, streaming, delete-heavy, multi-writer, and terabyte-scale tables — all on the same engine, same hardware.

101K → 19K
files (81% reduction)
2,522 MB/s
peak throughput
99.8%
max file reduction
551M
deleted rows cleaned
TableSizeWorkloadFiles (B → A)ThroughputTimeNotes
balance_snapshots1,192 GBTB-Scale batch11,9573,2701,572 MB/s11 minSpark OOM on same hardware
user_accounts174 GBBatch8784002,269 MB/s74sSingle Node
events_analytics484 GBDelete-Heavy16,1287,198729 MB/s11m 21s23,433 delete files; 551M rows removed
raw_sdk_events8 GBStreaming42,63369167 MB/s138s99.8% file reduction
site_traffic292 GBMulti-Writer2,7407541,465 MB/s3m 25sSingle partition
cluster_registry322 GBBatch9984402,522 MB/s2mPeak throughput

Compaction cost per TB

Normalized to Spark = 100%

Apache Spark100%
AWS S3 Tables / Databricks100%
LakeOps10%

Source: 200 GB (~1 TB uncompressed) benchmark. Spark cost index 100 vs LakeOps 10.

Self-improving: same table, zero config changes

balance_snapshots — 1.192 TB across consecutive runs

Run 122 min · 925 MB/s
Run 218 min · 1,100 MB/s
Run 3 (learned)11 min · 1,572 MB/s

Same data and hardware; planner learns workload telemetry and improves runtime from 22 to 11 minutes.

Part of the platform

Compaction doesn't run in isolation

In LakeOps, compaction is one step in a coordinated maintenance sequence — automatically paired with snapshot expiration, orphan cleanup, manifest optimization, and Puffin statistics in a single adaptive policy.

Compact

Merge small files, sort by query patterns

Expire Snapshots

Remove outdated metadata and data

Rewrite Manifests

Consolidate for faster planning

Orphan Cleanup

Delete unreferenced storage objects

Get started

See compaction in action

Connect your catalog and get a free compaction analysis in 10 minutes — see exactly which tables need attention, how many files can be eliminated, and what cost savings look like on your workload.

No commitment · Typically 30 min