Skip to main content

icetrace

EXPLAIN ANALYZE for Apache Iceberg metadata — find out why your query scanned 100% of files, without Spark.

PyPI License: Apache-2.0 Python 3.11+

Your Iceberg table looks healthy — 256 MB files, few snapshots, compaction enabled — yet a selective WHERE query still scans 95% of the table.

Why? Iceberg skips data silently at 4 metadata stages. When bounds are missing past column #32, truncated at 16 chars, or overlapping after binpack compaction, no query engine tells you why files weren't pruned.

icetrace reads only Iceberg metadata (never Parquet data files, strictly read-only), simulates Iceberg's exact 4-stage pruning pipeline locally, and pinpoints the exact root cause in seconds — from Cursor, Claude Code, or your terminal.


See It in 5 Seconds (No Credentials Needed)

uvx icetrace demo
Predicate: tenant_id = 'org_prod_us_east_03_0042'

Stage 1  Manifest List     8 evaluated ──▶ 0 pruned ──▶ 8 surviving  (0.0%)
Stage 2  Partitions        8 evaluated ──▶ 0 pruned ──▶ 8 surviving  (0.0%)
Stage 3  Column Bounds     8 evaluated ──▶ 0 pruned ──▶ 8 surviving  (0.0%)

Root Cause: TRUNCATED_BOUNDS (8/8 files)
  tenant_id uses Iceberg's default truncate(16). All 8 files share prefix
  'org_prod_us_east', collapsing min/max bounds and disabling data skipping.

Fix:
  ALTER TABLE ... SET TBLPROPERTIES ('write.metadata.metrics.column.tenant_id' = 'full');
  CALL system.rewrite_data_files(table => '...', strategy => 'sort', sort_order => 'tenant_id');
Per-Column Pruning Readiness (O(N log N) Sweep-Line Overlap)
  #   Column      Mode          Bounds   Overlap   Trunc%   Grade
  1   event_id    truncate(16)    100%      0.00       0%     A    ✓ well-sorted
  2   tenant_id   truncate(16)    100%      1.00     100%     F    ✗ truncate(16) collision
  3   amount      truncate(16)    100%      0.98       0%     F    ✗ overlapping ranges
 35   trace_key   none              0%         -       0%     F    ✗ past 32-col metrics cutoff

Use Inside Cursor or Claude Code (MCP)

Ask your agent directly while your SQL, dbt model, or table DDL is open:

"Run explain_scan on prod.events for WHERE event_ts >= '2026-11-20' AND tenant_id = 'org_prod_8491'. Why did Athena scan 180 GB?"

Claude Code:

claude mcp add --transport stdio --scope user icetrace -- uvx --from "icetrace[glue]" icetrace-mcp

Cursor (.cursor/mcp.json or ~/.cursor/mcp.json):

{
  "mcpServers": {
    "icetrace": {
      "command": "uvx",
      "args": ["--from", "icetrace[glue]", "icetrace-mcp"],
      "env": {
        "AWS_PROFILE": "${env:AWS_PROFILE}",
        "AWS_REGION": "us-east-1"
      }
    }
  }
}

Works with AWS Glue, REST Catalogs (Polaris, Lakekeeper, Nessie, Unity, S3 Tables), Hive, and SQL via standard ~/.pyiceberg.yaml or ICETRACE_CATALOG_TYPE env vars.


Install (CLI)

# Zero-install
uvx icetrace demo

# Homebrew (macOS / Linux)
brew tap sanspareilsmyn/icetrace https://github.com/sanspareilsmyn/icetrace
brew install icetrace

# uv tool (with AWS Glue & S3)
uv tool install "icetrace[glue]"

What It Catches

Command / MCP Tool What It Proves (Metadata Only)
explain / explain_scan Exact 4-stage pruning funnel (100% parity with PyIceberg plan_files()) + per-file root-cause attribution (MISSING_METRICS_COL_LIMIT, MISSING_METRICS_WRITER, TRUNCATED_BOUNDS, OVERLAPPING_RANGES, SPEC_EVOLUTION_MISMATCH, UNPUSHABLE_PREDICATE).
audit / audit_pruning_health Per-column bounds coverage, truncate(N) prefix collision %, $O(N \log N)$ domain-weighted sweep-line overlap ratio (0.0 = sorted, 1.0 = full overlap), manifest interleaving, small files, and V2/V3 delete amplification.
diff / diff_snapshots Pinpoints which snapshot spiked manifests, dropped bounds coverage, or regressed pruning for a query.
inspect / inspect_table_layout Instant metadata.json dump (zero manifest reads): format version, column ordinals & resolved metrics modes, evolved partition specs, sort order, retention properties.

Safety Guarantees

  • Strictly Read-Only: Never mutates, compacts, or expires tables (readOnlyHint: true, destructiveHint: false on all MCP tools).
  • Metadata-Only: Only reads metadata.json, manifest lists, and manifest Avro files — never scans Parquet/ORC data.
  • Bounded Cost: Enforces max_manifests (default 200) so huge production tables never hang or burn S3 GETs.
  • Local & Zero-Telemetry: Credentials and metadata never leave your machine.

Roadmap · Changelog · Agent Skill · Contributing · Apache-2.0

Metadata

Release files for icetrace 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for icetrace 0.1.1
File Size Uploaded Provenance Actions
icetrace-0.1.1.tar.gz 275.4 kB With provenance Details for icetrace-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for icetrace 0.1.1
File Interpreter ABI Platform Actions
icetrace-0.1.1-py3-none-any.whl Python 3 none any Details for icetrace-0.1.1-py3-none-any.whl

Total release size: 317.5 kB

Release files / icetrace-0.1.1.tar.gz

Download URL icetrace-0.1.1.tar.gz
Size 275.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c7e97805d632da10930ef057e961ab290a366f45a9c048a5cfce926082da5c52
BLAKE2b-256 checksum
How to use checksums
50fae8d36bbeea5141978df768f3d4c6e6aaa8cf34b4ff5301437bc6e5ec9a20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / icetrace-0.1.1-py3-none-any.whl

Download URL icetrace-0.1.1-py3-none-any.whl
Size 42.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
06f016c0c07839a4e3f72434bdd23c0cd126f1713cd0c9ea2e13f44980225b31
BLAKE2b-256 checksum
How to use checksums
930733f994c212cfa7295f11f149bb7cec3b6d37126ebcad2f3701c389e69ed0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for icetrace 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for icetrace-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page