A developer is optimizing data access for a multiplayer mobile game. The player data is stored in an Amazon DynamoDB table with `GameID` as the partition key and `PlayerID` as the sort key. The table includes attributes for `HighScore` and `RegistrationDate`. The developer needs to implement two new requirements:
1. Retrieve the top 10 players for a specific game, sorted by `HighScore` from highest to lowest.
2. Retrieve the profiles of 50 specific players across various games using a single network request.
Which combination of actions should the developer take to meet these requirements efficiently? (Select TWO.)
- Create a Global Secondary Index (GSI) with `GameID` as the partition key and `HighScore` as the sort key, and query the GSI with `ScanIndexForward` set to `false`.Cevap
- Use the `BatchGetItem` API operation to retrieve the 50 player profiles.Cevap
- CUse the `Scan` API operation with a `FilterExpression` to search for players of a specific game and sort the results client-side.
- DInstantiate the DynamoDB client inside the retrieval function by hardcoding temporary IAM credentials to fetch the player profiles.
- EIncrease the provisioned Read Capacity Units (RCUs) for the entire table to resolve partition throttling errors instead of using batch operations.
Cevap
Create a Global Secondary Index (GSI) with the game identifier as the partition key and the high score as the sort key, query it with the sorting parameter set to false, and use the batch get operation to fetch multiple player profiles.
To retrieve sorted high scores, a Global Secondary Index (GSI) with the game identifier as the partition key and high score as the sort key must be created, and then queried with the scan index direction reversed. To retrieve multiple distinct items across partitions in a single network request, the batch get operation is the most efficient and standard API call.
Adım Adım Çözüm
Anahtar Kavram
DynamoDB Index design and batch operations