'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?
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | hunterhacker |