1
votes

I have table in Redshift as with columns ‘a1_timestamp, a2_cd, a3_id,a4,a5’ (in that order). I want to create sort key on columns ‘a3_id and a1_timestamp’.

Since table is created with a1_timestamp as 1st column and a3_id as 3rd columns, do sort key need to be in that order? These are compound sort keys.

1

1 Answers

0
votes

Column order doesn't affect sort keys. You can create a sort key altering the table.

When data is loaded into a table, the data is loaded in the order of the sort key. When you alter the sort key, Amazon Redshift reorders the data

But that won't reorder the columns.