Does DynamoDb allows duplicate sortKey in Index

7.7k views Asked by At

Does DynamoDb allows duplicate sortKey in Global Secondary Index and Local Secondary Index.

I have a table with partitionkey and sortKey and want to introduce GSI and LSI with different sortKey attribute, can this attribute have duplicates?

1

There are 1 answers

0
Charles On BEST ANSWER

Yes...

GSI

In a DynamoDB table, each key value must be unique. However, the key values in a global secondary index do not need to be unique.

LSI

In a DynamoDB table, the combined partition key value and sort key value for each item must be unique. However, in a local secondary index, the sort key value does not need to be unique for a given partition key value.