Query icon
If icon
SlackIncomingWebhook icon
Schedule icon

Apache Iceberg Table Snapshot Sprawl and Small File Compaction Sentinel

Audits Apache Iceberg table snapshots and metadata file sprawl to prevent query planning latency regression.

Categories
CloudData

How it works

This workflow connects to Apache Iceberg metadata catalogs via the JDBC Trino plugin to query the $snapshots metadata system table for critical production tables. Every append, overwrite, or delete transaction in Apache Iceberg creates an immutable snapshot. If table maintenance procedures (such as expire_snapshots and remove_orphan_files) are not run periodically, tables accumulate hundreds of old snapshots and thousands of manifest list files. This metadata sprawl causes query planning times in Trino, Spark, and Presto to balloon from milliseconds to minutes. This workflow tracks snapshot counts and alerts data lake teams.

What you get

  • Real-time visibility into Apache Iceberg table metadata bloat.
  • Prevents query planning latency degradation in lakehouse query engines.
  • Quantitative tracking of total active snapshots.

Who it's for

  • Data Lakehouse Architects and Lakehouse Platform Engineers.
  • Analytics Engineers operating Apache Iceberg on S3, GCS, or Azure ADLS.

Why orchestrate this with Kestra

  • Native Trino Driver Integration: Direct SQL queries against Iceberg metadata tables.
  • Continuous Lakehouse Hygiene: Automates periodic maintenance audits weekly.
  • Direct Team Alerts: Escalates metadata sprawl directly to data engineering channels.

Prerequisites

  • Trino or Starburst cluster with Iceberg catalog configured.
  • Secret SLACK_WEBHOOK configured in Kestra.

Quick start

  1. Import the blueprint.
  2. Input Trino host, port, catalog, schema, and table name.
  3. Run the workflow to inspect snapshot counts.

How to extend

  • Automatically trigger ALTER TABLE ... EXECUTE expire_snapshots(retention_threshold => '7d').
  • Check the $files metadata table to identify small file fragmentation requiring compaction.

Links

Orchestrate with Kestra
Orchestrate Slack with Kestra
Share this Blueprint
See How

New to Kestra?

Use blueprints to kickstart your first workflows.