Before you start
Choose a writable Iceberg catalog in Workbench and an unused practice namespace. These examples usemaintenance_docs, as described in Inspect and prepare a table. Native maintenance currently requires Iceberg format v2.
Create, compact, and check a table
This complete script creates six rows in three writes, checks the logical data, compacts eligible files, and checks the same totals again. It replaces onlymaintenance_docs.data_demo.
The row query should still return IDs 1 through 6 with their original values. The 1 MiB output target and 8 MiB group limit are small practice values, not a production sizing recommendation.
Read the maintenance result
Select theCALL statement’s result in Workbench’s statement selector.
Refresh the table’s Inspection view and compare current data-file counts, sizes, and snapshot identity. Fewer files with unchanged visible rows is the intended outcome for small-file compaction. Exact counts depend on file eligibility and the writer. Zero rewritten files is a valid no-op when no group qualifies.
Files are grouped within their partitions. Several partitions can produce several output files. Compaction does not change the table’s partition specification.
Sort by a column
Run the setup above first. This alternative sorts rewritten data byregion, then id. min_input_files => 1 allows an eligible single-file group after the earlier bin-pack call.
SELECT; use ORDER BY when query output needs an order. This call does not set a permanent sort rule for later writes.
Z-order several columns
Z-order is another layout strategy for the same practice table. It requires distinct column names with supported types.Size work for the available memory
max_group_size_bytes limits candidate input grouping. It is not a promise about decoded memory use. Compressed input can expand when read, and sorting needs working memory. The provider also applies the instance’s file, byte, and memory limits.
For resource-limit failures, use smaller groups or ask the operator to review maintenance task limits. Keep target_file_size_bytes no greater than max_group_size_bytes.
This provider does not currently accept a where argument to select a subset of table files for these calls.