Vivek
Vivek

Reputation: 102

Add multiple sort keys in AWS DynamoDB

I want to add more than one sort key in an AWS DynamoDB table.

I tried the adding it on create table but my table is already ready and now and I have to change my table schema.

Upvotes: 1

Views: 3861

Answers (1)

Maurice
Maurice

Reputation: 13108

You have to delete the old table and create a new table if you want to use a local secondary index, because that has to be created at table creation time.

Alternatively you could create a global secondary index with the same partition key but a different sort key. This will be more expensive in terms of storage cost.

To learn more about the differences between secondary indexes, check out: Improving Data Access with Secondary Indexes in the DynamoDB Developer Guide.

Upvotes: 4

Related Questions