

# Disabling compaction optimizer
<a name="disable-compaction"></a>

 You can disable automatic compaction for a particular Apache Iceberg table using Amazon Glue console or Amazon CLI. 

------
#### [ Console ]

1. Sign in to the Amazon Web Services Management Console and open the Amazon Glue console at [https://console.amazonaws.cn/glue/](https://console.amazonaws.cn/glue/).

1. On the left navigation, under **Data Catalog**, choose **Tables**. 

1. From the tables list, choose the Iceberg table that you want to disable compaction.

1. Choose the **Table optimization** tab on the lower section of the **Tables details** page.

1. From **Actions**, choose **Disable**, and then choose **Compaction**.

1.  Choose **Disable compaction** on the confirmation message. You can re-enable compaction at a later time. 

    After the you confirm, compaction is disabled and the compaction status for the table turns back to `Disabled`.

------
#### [ Amazon CLI ]

In the following example, replace the account ID with a valid Amazon account ID. Replace the database name and table name with actual Iceberg table name and the database name. Replace the `roleArn` with the Amazon Resource Name (ARN) of the IAM role and actual name of the IAM role that has the required permissions to run compaction.

```
aws glue update-table-optimizer \
  --catalog-id {{123456789012}} \
  --database-name {{iceberg_db}} \
  --table-name {{iceberg_table}} \
  --table-optimizer-configuration '{"roleArn":"arn:aws:iam::{{123456789012}}:role/{{optimizer_role}}", "enabled":'false', "vpcConfiguration":{"glueConnectionName":{{"glue_connection_name"}}}}'\ 
  --type compaction
```

------
#### [ Amazon API ]

Call [UpdateTableOptimizer](https://docs.amazonaws.cn/glue/latest/dg/aws-glue-api-table-optimizers.html#aws-glue-api-table-optimizers-UpdateTableOptimizer) operation to disable compaction for a specific table.

------