> ## Documentation Index
> Fetch the complete documentation index at: https://www.artie.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Tuning, partitioning, and maintenance

> Reference for Apache Iceberg format versions, VARIANT columns, Parquet compression, partition specs, and scheduled table maintenance in Artie.

Configure table format versions, Parquet write tuning, per-table partitioning, and scheduled table maintenance on your Apache Iceberg pipelines.

## Table format and write tuning

Set these fields in your pipeline's destination configuration (`specificDestCfg` in the Artie API) to control how Artie creates and writes Iceberg tables.

| Setting                          | Type                  | Default              | Description                                                                                                                                                                                                                                                                                                                                                                                         |
| :------------------------------- | :-------------------- | :------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `icebergFormatVersion`           | `v2` \| `v3`          | `v2`                 | Iceberg table format version for newly created tables. `v3` requires the native engine and a non-S3 Tables catalog. Tables cannot be downgraded from `v3`.                                                                                                                                                                                                                                          |
| `icebergJSONAsVariant`           | `boolean`             | `false`              | Store JSON columns as Iceberg v3 `VARIANT` instead of strings. Requires `icebergFormatVersion: "v3"`, the native engine, and a non-S3 Tables catalog.                                                                                                                                                                                                                                               |
| `icebergTargetFileSizeMB`        | `integer`             | `0` (engine default) | Target Parquet data file size in MB (`write.target-file-size-bytes`). Must be `>= 0`.                                                                                                                                                                                                                                                                                                               |
| `icebergParquetCompression`      | `string`              | `zstd`               | Parquet compression codec (`write.parquet.compression-codec`): `zstd`, `snappy`, `gzip`, `lz4`, `brotli`, or `uncompressed`.                                                                                                                                                                                                                                                                        |
| `icebergParquetCompressionLevel` | `integer`             | Codec default        | Compression level (`write.parquet.compression-level`). Valid ranges: `zstd` (`1`–`22`), `gzip` (`1`–`9`), `brotli` (`0`–`11`). Rejected for `snappy`, `lz4`, `uncompressed`, or when `icebergParquetCompression` is unset.                                                                                                                                                                          |
| `icebergMetadataCompression`     | `string`              | `none`               | Metadata JSON compression (`write.metadata.compression-codec`): `none`, `gzip`, or `zstd`. `zstd` requires the native engine.                                                                                                                                                                                                                                                                       |
| `icebergTableProperties`         | `map<string, string>` | `{}`                 | Additional Iceberg table properties applied when creating new tables. Reserved keys (`format-version`, `write.metadata.compression-codec`, `write.parquet.compression-codec`, `write.parquet.compression-level`, `write.target-file-size-bytes`, `write.delete.mode`, `write.update.mode`, `write.merge.mode`, `write.data.path`, `write.metadata.path`, `write.object-storage.path`) are rejected. |

## Per-table partitioning

Configure Iceberg partition transforms per table using `advancedSettings.icebergPartitionSpec` on each table entry in your pipeline configuration. Partition specs are applied while the table is still empty—changing `icebergPartitionSpec` later does not repartition existing data.

Each entry accepts `sourceColumn`, `transform`, and an optional `name`. For parameterized transforms (`bucket` and `truncate`), include the integer argument inside the `transform` string (for example, `bucket[16]` or `truncate[10]`).

```json
{
  "advancedSettings": {
    "icebergPartitionSpec": [
      {
        "sourceColumn": "created_at",
        "transform": "day",
        "name": "created_at_day"
      },
      {
        "sourceColumn": "tenant_id",
        "transform": "bucket[16]",
        "name": "tenant_id_bucket"
      }
    ]
  }
}
```

### Supported transforms

| Transform | Syntax        | Description                                                                    |
| :-------- | :------------ | :----------------------------------------------------------------------------- |
| Identity  | `identity`    | Partition directly on the column's exact value.                                |
| Year      | `year`        | Partition a date or timestamp column by calendar year.                         |
| Month     | `month`       | Partition a date or timestamp column by calendar month.                        |
| Day       | `day`         | Partition a date or timestamp column by calendar day.                          |
| Hour      | `hour`        | Partition a timestamp column by hour.                                          |
| Bucket    | `bucket[N]`   | Hash-partition into `N` buckets (`N > 0`).                                     |
| Truncate  | `truncate[W]` | Truncate strings, integers, decimals, or binary values to width `W` (`W > 0`). |

## Scheduled table maintenance

Scheduled Iceberg table maintenance is available on **REST**, **AWS Glue**, **Hive Metastore**, and **SQL** catalogs. Every maintenance job starts **off** by default and runs once a day after you enable it in your Iceberg destination settings. **Amazon S3 Tables** manages its own compaction and snapshot expiration through AWS, so Artie's maintenance switches are disabled for S3 Tables.

> **Note:**
>
> Scheduled table maintenance is enabled per workspace. Contact Artie support if you do not see the **Table maintenance** section in your Iceberg destination settings.

### Available maintenance jobs

| Job                          | Field                    | What it does                                                                                                                                             |
| :--------------------------- | :----------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Expire snapshots**         | `expireSnapshots`        | Removes snapshots older than the retention window (7 days, retaining at least the last 10 snapshots) to keep metadata lean and reclaim superseded files. |
| **Compact small files**      | `compactSmallFiles`      | Rewrites small Parquet data files into larger target-sized files to improve analytical query speed.                                                      |
| **Rewrite delete files**     | `rewriteDeleteFiles`     | Rewrites data files that have accumulated many deletes and applies those deletes so readers scan less overhead.                                          |
| **Rewrite position deletes** | `rewritePositionDeletes` | Drops position delete entries that point to data files the table no longer contains.                                                                     |
| **Rewrite manifests**        | `rewriteManifests`       | Combines small manifest files into fewer, larger manifests to speed up query planning.                                                                   |

**Orphan file removal**

`removeOrphanFiles` is not yet available in scheduled maintenance because listing and deleting unreferenced files under table locations requires additional catalog permission verification.