Search code examples
databaseamazon-web-servicesamazon-dynamodbdynamodb-queries

DynamoDB scan - are items with same partition key returned in order


I know DynamoDB scan doesn't guarantee ordering of items across the board but i wonder if atleast items with the same partition key still get returned in order?

For example would the following events atleast be returned in order?

pk:customer-event / sk:1
pk:customer-event / sk:2
pk:customer-event / sk:3

I have tested with a small dataset and it does seem to have the behaviour i'm after but i don't want to assume behaviour.


Solution

  • Yes, that’s how scans work. The PKs are in the order of their hashed values, then SKs in the order of their true values.