ALTER TABLE ... ADD COLUMN adds one or more new columns to an existing Amazon Redshift table without rewriting existing data.
ALTER TABLE ADD COLUMN updates a table’s metadata so you can store new attributes without recreating or copying data. The command is quick because Redshift appends the column definition rather than rewriting blocks.
The shortest form is:
ALTER TABLE table_name
ADD [ COLUMN ] column_name data_type [ DEFAULT expr ] [ ENCODE encoding ];
Yes, separate definitions with commas:
ALTER TABLE table_name
ADD COLUMN col1 type1,
col2 type2 DEFAULT val2;
Columns are NULL-able by default, so omit NOT NULL:
ALTER TABLE Orders
ADD COLUMN shipping_method VARCHAR(20);
Add DEFAULT to back-fill future inserts. Existing rows store NULL until you run an UPDATE:
ALTER TABLE Products
ADD COLUMN last_restocked DATE DEFAULT CURRENT_DATE;
Run an UPDATE immediately after adding the column:
UPDATE Products
SET last_restocked = order_date
FROM OrderItems oi
JOIN Orders o ON o.id = oi.order_id
WHERE Products.id = oi.product_id;
1) Batch multiple columns in one statement to reduce commits. 2) Always specify ENCODE when adding large text or numeric columns to keep compression consistent. 3) Use DEFAULT only when every future row needs the same value—otherwise leave NULL and handle in queries.
Omitting DEFAULT on NOT NULL. Redshift does not allow NOT NULL without DEFAULT. Fix by adding DEFAULT or leave the column nullable.
Expecting data rewrite time. ADD COLUMN is metadata-only; plan a separate UPDATE if you need historical values.
You can, but VACUUM may be required to reclaim space if you inserted data. Use: ALTER TABLE table_name DROP COLUMN col;
It takes a brief metadata lock, usually milliseconds, so concurrent reads continue unaffected.
Yes, but only one identity per table and it must be BIGINT. Syntax: ADD COLUMN new_id BIGINT IDENTITY(1,1);
Apply ENCODE: ADD COLUMN details VARCHAR(100) ENCODE ZSTD;
Use ANALYZE COMPRESSION to pick the best codec.
No. Redshift only updates system catalogs, so the operation is nearly instantaneous.
Column order is logical—Redshift always appends new columns at the end. Use SELECT with explicit column lists if order matters.
Yes, the hard limit is 1,600 columns per table including compression metadata.