How to alter redshift column encoding in place?
Ketan is correct. AWS does provide a utility, https://github.com/awslabs/amazon-redshift-utils/tree/master/src/ColumnEncodingUtility, that can take care of it for you though.
Yes - this is now a supported option as of 20th Oct 2020, see AWS docs :
ALTER TABLE table_name
{
| ALTER COLUMN column_name ENCODE new_encode_type
https://aws.amazon.com/about-aws/whats-new/2020/10/amazon-redshift-supports-modifying-column-comprression-encodings-to-optimize-storage-utilization-query-performance/
https://docs.aws.amazon.com/redshift/latest/dg/r_ALTER_TABLE.html
Update: as pointed out by @gelin: since Oct 2020, altering column encodings in place is now supported: ALTER TABLE tablename ALTER COLUMN columnname ENCODE newencode
. More info here.
No, this is not supported.
From the documentation, the options that you have:
- apply a compression type, or encoding, to the columns in a table manually when you create the table
- use the COPY command to analyze and apply compression automatically (on an empty table)
- specify the encoding for a column when it is added to a table using the ALTER TABLE command
From the same documentation,
You cannot change the compression encoding for a column after the table is created.