Lester Gray
Lester Gray

Reputation: 337

AWS DynamoDB : Why does "Keys Only" projection not include the Sort Key of the Table?

I was reading the official documentation for AWS' GSI. In the documentation they are indicating that the GameScores table has a Primary Key (UserID) and a Sort Key(GameTitle). They then create a GSI called GameTitleIndex on GameTitle and TopScore with KEYS ONLY projection - they mention that the new GSI will have GameTitle and TopScore AS WELL the primary key attributes projected.

But they ONLY indicate that UserID (And not GameTitle) is projected. They even show a diagram of the GSI where only UserID is shown and not GameTitle. Isn't GameTitle a Key attribute (since its a COMPOSITE Primary Key?) and shouldn't BOTH UserID and GameTitle have been projected on the GSI?

enter image description here

Upvotes: 1

Views: 1169

Answers (1)

hunterhacker
hunterhacker

Reputation: 7142

GameTitle is right there as the partition key in the GSI. It's not going to appear twice. An attribute acting as a key is still present.

Upvotes: 1

Related Questions