I was modeling a DynamoDB table and noticed that one solution I was considering could lead to a particular scenario of having duplicate keys on the GSI. The first tests I ran to determine the order proved inconclusive, so I moved to a different approach.
However, I am still curious if there is any hidden logic to tiebreaker the keys on a Global Secondary Index (GSI).
Here is an example scenario with the following structure and items:
pk | sk | gsi_sk |
---|---|---|
A | a | a |
A | b | a |
A | c | a |
Suppose I am querying with the GSI partition key pk and sort key gsi_sk, but I only provide the pk value of A. How would the order of the results be decided?
I would appreciate any insights or explanations on this topic. Thank you!