1
votes

We are using AWS Database Migration Service to migrate our RDS MySQL Aurora database to AWS Redshift.

We want to add a SORT KEY to one of the Redshift tables.

How can we do it while copying data to Redshift using AWS DMS from a MySQL source?

1

1 Answers

0
votes

Sort key is an attribute of the Redshift table. You should be able to tweak the table DDL generated by DMS SCT (schema conversion tool) to add the sort key.

If you are loading into an empty table Redshift will sort the data for you. If the table already contains data then the data is loaded in the received order and you need to run VACUUM my_table; after loading to fully sort it.

Note that having a small % of the table unsorted is usually fine. Since VACUUM can take some time you may wish to run it overnight or on the weekend.