How to add a sort key to an existing table in AWS Redshift

后端 未结 7 801
孤街浪徒
孤街浪徒 2021-01-01 09:24

In AWS Redshift, I want to add a sort key to a table that is already created. Is there any command which can add a column and use it as sort key?

7条回答
  •  迷失自我
    2021-01-01 10:15

    I followed this approach for adding the sort columns to my table table_transactons its more or less same approach only less number of commands.

    alter table table_transactions rename to table_transactions_backup;
    create table table_transactions compound sortkey(key1, key2, key3, key4) as select * from table_transactions_backup;
    drop table table_transactions_backup;
    

提交回复
热议问题