> For the complete documentation index, see [llms.txt](https://upsolver.gitbook.io/content/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://upsolver.gitbook.io/content/reference-1/sql-commands/iceberg-tables/upsolver-managed-tables/alter-iceberg-table.md).

# ALTER ICEBERG TABLE

## Syntax

### **Changing table options**

Alters  previously configured options for the specified Apache Iceberg table:

```sql
ALTER ICEBERG TABLE <table_identifier> 
    SET <table_option> = <value>;
```

### **Partitioning/Clustering**

Users can change the partition or cluster columns of an existing table. Additionally, you can switch from partitioning to clustering and vice versa, with these changes applying to data moving forward.

**Changing columns**

Changes the partition/cluster columns of an existing table. This change does not rebuild the existing data according to the new partitioning, but will apply the new partitioning to data moving forward.

Partitioned table example:

```sql
ALTER TABLE <table_name> PARTITION BY <column_name> [, ...];
```

Clustered table example:

```sql
ALTER TABLE <table_name> CLUSTER BY <column_name> [, ...];
```

Note  you can use any [partition transforms](https://iceberg.apache.org/spec/#partition-transforms) supported by iceberg. for example:

```sql
ALTER TABLE <table_name> PARTITION BY
  TRUNCATE(10, <column_name>),
  DAY(<timestamp_column_name>);
```

**Stop partitioning\clustering**&#x20;

To stop table partitioning or clustering moving forward:

```sql
ALTER TABLE <table_name> PARTITION BY ();
```

#### Switching Between Partitioning and Clustering

You can also change the table structure from clustering to partitioning and vice versa, which will apply to data moving forward.

### **Sorting evolution**&#x20;

Changes the sorting columns of an existing table.

This will affect the data written from now onwards and new compactions will write data using the new sorting.

```sql
ALTER TABLE <table_name> ORDER BY <column_name> [ASC | DESC] [, ...]
```

To disable sorting completely:

```sql
ALTER TABLE <table_name> ORDER BY ()
```

If you wishes to re-sort old data after changing the sorting, you can trigger a compaction with [OPTIMIZE TABLE](/content/reference-1/sql-commands/iceberg-tables/upsolver-managed-tables/optimize-iceberg-table.md) command.

### Examples

Modifying table options:

<pre class="language-sql"><code class="lang-sql">ALTER ICEBERG TABLE my_iceberg_table
SET compute_cluster = "my_compute_cluster",
<strong>iceberg.read.split."planning-lookback"='10';
</strong></code></pre>

Changing partitions columns:

```sql
ALTER ICEBERG TABLE my_iceberg_table PARTITION BY COLUMN1, COLUMNS2;
```

Changing Sort columns:

```sql
ALTER ICEBERG TABLE my_iceberg_table ORDER BY COLUMN1 DESC, COLUMNS2 ASC;
```

{% hint style="warning" %}
`Note` that not all table options are mutable.&#x20;

All mutable options are denoted by **— editable** in the individual option descriptions.
{% endhint %}

To check if a certain table option is mutable, see [CREATE ICEBERG TABLE](/content/reference-1/sql-commands/iceberg-tables/upsolver-managed-tables/create-iceberg-table.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://upsolver.gitbook.io/content/reference-1/sql-commands/iceberg-tables/upsolver-managed-tables/alter-iceberg-table.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
