Streaming ingest creates many small files. Without maintenance, queries slow down as file count grows. R2 Data Catalog automates the two most critical operations.
Merges small data files into larger, optimized files. Reduces file count, improves query speed, and increases compression efficiency.
Removes old table snapshots to reduce metadata bloat and storage costs while preserving recent history.
# Enable compaction (target 128 MB files)npx wrangler r2 bucket catalog compaction enable \my-bucket --target-size 128 --token $TOKEN# Enable snapshot expirationnpx wrangler r2 bucket catalog snapshot-expiration \enable my-bucket --older-than-days 7 \--retain-last 10 --token $TOKEN