You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Control compaction settings for individual Iceberg tables
4
+
products:
5
+
- r2
6
+
date: 2025-10-06T13:00:00
7
+
hidden: false
8
+
---
9
+
10
+
You can now enable compaction for individual [Apache Iceberg](https://iceberg.apache.org/) tables in [R2 Data Catalog](/r2/data-catalog/), giving you fine-grained control over different workloads.
11
+
12
+
```bash
13
+
# Enable compaction for a specific table (no token required)
Copy file name to clipboardExpand all lines: src/content/docs/r2/data-catalog/about-compaction.mdx
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,12 @@ Every write operation in [Apache Iceberg](https://iceberg.apache.org/), no matte
21
21
22
22
R2 Data Catalog can now [manage compaction](/r2/data-catalog/manage-catalogs) for Apache Iceberg tables stored in R2. When enabled, compaction runs automatically and combines new files that have not been compacted yet.
23
23
24
+
You can enable compaction at two levels:
25
+
-**Catalog-level**: Applies to all tables in your R2 bucket
26
+
-**Table-level**: Fine-grained control for specific tables
27
+
28
+
Table-level settings allow you to customize compaction behavior for different workloads within the same bucket.
29
+
24
30
Compacted files are prefixed with `compacted-` in the `/data/` directory.
After enabling, Wrangler will return your catalog URI and warehouse name.
52
+
52
53
</TabItem>
53
54
</Tabs>
54
55
55
-
56
56
## Disable R2 Data Catalog on a bucket
57
57
58
58
When you disable the catalog on a bucket, it immediately stops serving requests from the catalog interface. Any Iceberg table references stored in that catalog become inaccessible until you re-enable it.
@@ -74,11 +74,14 @@ To disable the catalog on your bucket, run the [`r2 bucket catalog disable comma
Compaction improves query performance by combining the many small files created during data ingestion into fewer, larger files according to the set `target file size`. For more information about compaction and why it's valuable, refer to [About compaction](/r2/data-catalog/about-compaction/).
84
+
82
85
<TabssyncKey='CLIvDash'>
83
86
<TabItemlabel='Dashboard'>
84
87
@@ -96,23 +99,37 @@ Compaction improves query performance by combining the many small files created
96
99
</TabItem>
97
100
<TabItemlabel='Wrangler CLI'>
98
101
99
-
To enable the compaction on your catalog, run the [`r2 bucket catalog enable command`](/workers/wrangler/commands/#r2-bucket-catalog-compaction-enable):
102
+
To enable the compaction on your catalog, run the [`r2 bucket catalog compaction enable command`](/workers/wrangler/commands/#r2-bucket-catalog-compaction-enable):
-**Catalog-level**: Applies to all tables in the bucket, requires an API token as a service credential.
115
+
-**Table-level**: Applies to a specific table only.
116
+
117
+
:::
118
+
104
119
</TabItem>
105
120
</Tabs>
106
121
107
122
:::note[API token permission requirements]
108
123
Compaction requires a Cloudflare API token with both R2 storage and R2 Data Catalog read/write permissions to act as a service credential. The compaction process uses this token to read files, combine them, and update table metadata.
109
124
110
125
Refer to [Authenticate your Iceberg engine](#authenticate-your-iceberg-engine) for details on creating a token with the required permissions.
126
+
:::
111
127
112
-
Once enabled, compaction applies retroactively to all existing tables and automatically to newly created tables. During open beta, we currently compact up to 2 GB worth of files once per hour for each table.
128
+
Once enabled, compaction applies retroactively to all existing tables (for catalog-level) or the specified table (for table-level). During open beta, we currently compact up to 2 GB worth of files once per hour for each table.
113
129
114
130
## Disable compaction
115
-
Disabling compaction will prevent the process from running for all tables managed by the catalog. You can re-enable it at any time.
131
+
132
+
Disabling compaction will prevent the process from running for all tables (catalog-level) or a specific table (table-level). You can re-enable it at any time.
116
133
117
134
<TabssyncKey='CLIvDash'>
118
135
<TabItemlabel='Dashboard'>
@@ -130,11 +147,16 @@ Disabling compaction will prevent the process from running for all tables manage
130
147
</TabItem>
131
148
<TabItemlabel='Wrangler CLI'>
132
149
133
-
To disable the compaction on your catalog, run the [`r2 bucket catalog disable command`](/workers/wrangler/commands/#r2-bucket-catalog-compaction-disable):
150
+
To disable the compaction on your catalog, run the [`r2 bucket catalog compaction disable command`](/workers/wrangler/commands/#r2-bucket-catalog-compaction-disable):
0 commit comments