What’s the best DynamoDB key structure?

You are building a game high score table in DynamoDB. You will store each user’s highest score for each game, with
many games, all of which have relatively similar usage levels and numbers of players. You need to be able to look up the
highest score for any game. What’s the best DynamoDB key structure?

You are building a game high score table in DynamoDB. You will store each user’s highest score for each game, with
many games, all of which have relatively similar usage levels and numbers of players. You need to be able to look up the
highest score for any game. What’s the best DynamoDB key structure?

A.
HighestScore as the hash / only key.

B.
GameID as the hash key, HighestScore as the range key.

C.
GameID as the hash / only key.

D.
GameID as the range / only key.

Explanation:
Since access and storage for games is uniform, and you need to have ordering within each game for the scores (to
access the highest value), your hash (partition) key should be the GameID, and there should be a range key for
HighestScore.
http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GuidelinesForTables.html#GuidelinesForTables.
Partitions



Leave a Reply 2

Your email address will not be published. Required fields are marked *


Sadeel Anjum

Sadeel Anjum

Definitely B