Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does DynamoDb allows duplicate sortKey in Index

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?

like image 503
rishabhjainps Avatar asked Feb 21 '26 08:02

rishabhjainps


1 Answers

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.

like image 137
Charles Avatar answered Feb 27 '26 08:02

Charles



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!