How to alter column data type in Amazon Redshift database?
I am not able to alter the column data type in Redshift; is there any way to modify the data type in Amazo
UNLOAD and COPY with table rename strategy should be the most efficient way to do this operation if retaining the table structure(row order) is important.
Here is an example adding to this answer.
BEGIN TRANSACTION;
ALTER TABLE RENAME TO _OLD;
CREATE TABLE ( );
UNLOAD ('select * from _OLD') TO 's3://bucket/key/unload_' manifest;
COPY FROM 's3://bucket/key/unload_manifest'manifest;
END TRANSACTION;