> **Experimental**
>
> `@aws-cdk/aws-redshift-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# ColumnEncoding

The compression encoding of a column.

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/table.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/@aws-cdk/aws-redshift-alpha/lib/table.ts#L426)

## Example

TypeScript:

```ts
import { ColumnEncoding } from '@aws-cdk/aws-redshift-alpha';

new Table(this, 'Table', {
  tableColumns: [
    { name: 'col1', dataType: 'varchar(4)', encoding: ColumnEncoding.TEXT32K },
    { name: 'col2', dataType: 'float', encoding: ColumnEncoding.DELTA32K },
  ],
  cluster: cluster,
  databaseName: 'databaseName',
});
```

Python:

```python
from aws_cdk.aws_redshift_alpha import Column, Column
from aws_cdk.aws_redshift_alpha import ColumnEncoding

Table(self, "Table",
    table_columns=[Column(name="col1", data_type="varchar(4)", encoding=ColumnEncoding.TEXT32K), Column(name="col2", data_type="float", encoding=ColumnEncoding.DELTA32K)
    ],
    cluster=cluster,
    database_name="databaseName"
)
```

Java:

```java
import software.amazon.awscdk.services.redshift.alpha.ColumnEncoding;

Table.Builder.create(this, "Table")
        .tableColumns(List.of(Column.builder().name("col1").dataType("varchar(4)").encoding(ColumnEncoding.TEXT32K).build(), Column.builder().name("col2").dataType("float").encoding(ColumnEncoding.DELTA32K).build()))
        .cluster(cluster)
        .databaseName("databaseName")
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.Redshift.Alpha
using Amazon.CDK.AWS.Redshift.Alpha;

new Table(this, "Table", new TableProps {
    TableColumns = new [] { new Column { Name = "col1", DataType = "varchar(4)", Encoding = ColumnEncoding.TEXT32K }, new Column { Name = "col2", DataType = "float", Encoding = ColumnEncoding.DELTA32K } },
    Cluster = cluster,
    DatabaseName = "databaseName"
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdkredshiftalpha/v2
import "github.com/aws/aws-cdk-go/awscdkredshiftalpha"

awscdkredshiftalpha.NewTable(this, jsii.String("Table"), &TableProps{
	TableColumns: []Column{
		&Column{
			Name: jsii.String("col1"),
			DataType: jsii.String("varchar(4)"),
			Encoding: awscdkredshiftalpha.ColumnEncoding_TEXT32K,
		},
		&Column{
			Name: jsii.String("col2"),
			DataType: jsii.String("float"),
			Encoding: awscdkredshiftalpha.ColumnEncoding_DELTA32K,
		},
	},
	Cluster: cluster,
	DatabaseName: jsii.String("databaseName"),
})
```

## Members

| Member | Description |
| --- | --- |
| `AUTO` | Amazon Redshift assigns an optimal encoding based on the column data. |
| `RAW` | The column is not compressed. |
| `AZ64` | The column is compressed using the AZ64 algorithm. |
| `BYTEDICT` | The column is compressed using a separate dictionary for each block column value on disk. |
| `DELTA` | The column is compressed based on the difference between values in the column. |
| `DELTA32K` | The column is compressed based on the difference between values in the column. |
| `LZO` | The column is compressed using the LZO algorithm. |
| `MOSTLY8` | The column is compressed to a smaller storage size than the original data type. |
| `MOSTLY16` | The column is compressed to a smaller storage size than the original data type. |
| `MOSTLY32` | The column is compressed to a smaller storage size than the original data type. |
| `RUNLENGTH` | The column is compressed by recording the number of occurrences of each value in the column. |
| `TEXT255` | The column is compressed by recording the first 245 unique words and then using a 1-byte index to represent each word. |
| `TEXT32K` | The column is compressed by recording the first 32K unique words and then using a 2-byte index to represent each word. |
| `ZSTD` | The column is compressed using the ZSTD algorithm. |

## Referenced by

- [`Column`](/v2/docs/@aws-cdk_aws-redshift-alpha.Column).encoding
